473,581 Members | 2,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net label creation

hi .. i am trying to make a webform where i can create label with out
actually going to the toolbox and dargging the thing over the webform in
design mode.

Is there a way to do that
i tried doing this

Imports System

Imports System.Windows. Forms

dim label1 as new label()
label1.BorderSt yle = System.Windows. Forms.BorderSty le.Fixed3D
' Set the ImageList to use for displaying an image.

'label1.ImageLi st = imageList1

' Use the second image in imageList1.

label1.ImageInd ex = 1

' Align the image to the top left corner.

label1.ImageAli gn = ContentAlignmen t.TopLeft

' Specify that the text can display mnemonic characters.

label1.UseMnemo nic = True

' Set the text of the control and specify a mnemonic character.

label1.Text = "First &Name:"

' Set the size of the control based on the PreferredHeight and
PreferredWidth values.

'label1.Size = New Size(label1.Pre ferredHeight, label1.Preferre dWidth)

label1.BringToF ront()

Me.label1.Size = New System.Drawing. Size(232, 20)
... but when i run the asp code .. this thing doesn't appear in my browser ..
what must i do .. please help ..
Nov 18 '05 #1
1 1243
Jos
ahmed wrote:
hi .. i am trying to make a webform where i can create label with out
actually going to the toolbox and dargging the thing over the webform
in design mode.

Is there a way to do that
i tried doing this

Imports System

Imports System.Windows. Forms

dim label1 as new label()
label1.BorderSt yle = System.Windows. Forms.BorderSty le.Fixed3D
' Set the ImageList to use for displaying an image.

'label1.ImageLi st = imageList1

' Use the second image in imageList1.

label1.ImageInd ex = 1

' Align the image to the top left corner.

label1.ImageAli gn = ContentAlignmen t.TopLeft

' Specify that the text can display mnemonic characters.

label1.UseMnemo nic = True

' Set the text of the control and specify a mnemonic character.

label1.Text = "First &Name:"

' Set the size of the control based on the PreferredHeight and
PreferredWidth values.

'label1.Size = New Size(label1.Pre ferredHeight, label1.Preferre dWidth)

label1.BringToF ront()

Me.label1.Size = New System.Drawing. Size(232, 20)
.. but when i run the asp code .. this thing doesn't appear in my
browser .. what must i do .. please help ..


It's called "creating a label dynamically" or "on-the-fly".

You forgot to add the label to your page:
Page.Controls.A dd(Label1)

(You could also add it to a Panel or to a PlaceHolder web control).

--

Jos Branders
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3885
by: Raymond H. | last post by:
Hello, 1- How to see, in a Label, the URL of a link that the mouse pass over? (in the WebBrower control in a vb projet). 2- How to create a menu and a submenu via a button Command1? and after, hot to delete these two menus? Thank in advance. divers_rh@hotmail.com Raymond H.
2
2019
by: ratedr1 | last post by:
I am currently trying to label rings (jewelry). They make specialized tags (shaped like a butterfly, barbell, dumbell, etc) for this purpose, the label goes through the ring, and then the ends stick together. What I want to do is type information on these tags rather than write on them, the only problem that I am having is that there is NO...
2
1746
by: Peter Rilling | last post by:
Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has some code that basically gets a string that will be written to the browser. ConditionalText.Eval is a method from my own library. As you can see, I have written some static text before and after the...
3
3084
by: Nick Dreyer | last post by:
I was quite surprised to notice that Sub New() gets called twice, once at declaration time and once at creation time. I can't figure out why it would be called at declaration if there is no class instance to work with. What is going on here: Sub Main Dim NewObject as MyClass MsgBox("Before Creation")
5
1771
by: Mark Olbert | last post by:
I have a composite control (under ASPNET2; derived from CompositeControl) which contains a label. The contents of the label are set when the control is created to a user-supplied value. What's confusing me is that on postback the contents of the label are not being restored from ViewState. I thought that happened automagically...but I guess...
2
3692
by: Beginner | last post by:
I have to print a Fedex shipping label on a Zebra(thermal) printer. I initially had the label information in a base64 string which I decoded into a memory stream. Now I need to send this memory stream to a thermal/label printer. How do I do this? Thanks for any help.
3
1799
by: John | last post by:
In my app I've created a label report (Avery 7162, 2 colums, 8 rows) with the wizzard. The report is based on a temp table that is created when the user pushes a button. After creation of the table the pushbutton opens the report. Now something weird happens. When I open the report manually a few or more times it remains intact. However,...
3
4189
by: seanacais | last post by:
I'm trying to build an unknown number of repeating gui elements dynamically so I need to store the variables in a list of dictionaries. I understand that Scale "variable" name needs to be a StringVar but I cannot figure out how to initialize the dictionary. I've tried the following code ps = PowerSupply() # Instantiate a Power Supply...
0
1520
by: Kevin McKinley | last post by:
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with {$}. How can i get rid of that? from Tkinter import * class MyApp: def __init__(self, parent): self.myparent = parent
0
7876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6563
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.