473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating an element in vb.net at run-time

Please tellme how do I write vb.net code for the following code:

var opt = document.createElement("option");
opt.text = j;
opt.value = j;
document.all(elementname).options.add(opt);

Feb 19 '07 #1
2 1011
Try the following:
Dim j As String = "Your text and value"
Dim opt As New ListItem(j)
Me.DropDownList1.Items.Add(opt)
This technique will automatically set the Text and Value properties to the
same value. If you prefer, you can set the Text and Value properties using
one of the following techniques instead:
Dim opt As New ListItem()
opt.Text = "Your text"
opt.Value = "Your value"

Dim opt As New ListItem("Your text", "Your value")
Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Garg" <sh**********@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
Please tellme how do I write vb.net code for the following code:

var opt = document.createElement("option");
opt.text = j;
opt.value = j;
document.all(elementname).options.add(opt);

Feb 19 '07 #2
On Feb 19, 11:52 am, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
Try the following:

Dim j As String = "Your text and value"
Dim opt As New ListItem(j)
Me.DropDownList1.Items.Add(opt)

This technique will automatically set the Text and Value properties to the
same value. If you prefer, you can set the Text and Value properties using
one of the following techniques instead:

Dim opt As New ListItem()
opt.Text = "Your text"
opt.Value = "Your value"

Dim opt As New ListItem("Your text", "Your value")

Good Luck!
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/

"Garg" <shivaniga...@gmail.comwrote in message

news:11**********************@q2g2000cwa.googlegro ups.com...
Please tellme how do I write vb.net code for the following code:
var opt = document.createElement("option");
opt.text = j;
opt.value = j;
document.all(elementname).options.add(opt);- Hide quoted text -

- Show quoted text -
thanks nathan!

Feb 19 '07 #3

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

Similar topics

6
by: gonzalo briceno | last post by:
I have been using phplib for a while and I really like the framework except for form creation. Maybe it is me but I in my opinion there isn't a good way to create forms or should I say, everything...
0
by: Brett Selleck | last post by:
We have an issue where the JAXB generated classes are creating an interface which references itself. The Schema is valid, and I have not seen this ran into before. The code is below. What is...
0
by: Fendi Baba | last post by:
Hi everyone I am new in this so please bear with me. I am trying to create a schema for a Quotation document. I created the creating the forms using Microsoft Infopath. I am creating my own...
1
by: Chris Kennedy | last post by:
How do create a dataset from scratch based on an XML schema. This will not be filled by a dataadapter. It will be a dataset which I add rows to and then save as an XML file. All the example depend...
0
by: Mark Broadbent | last post by:
can someone help me? After creating an xml schema file in VS 2003, I drag and drop a table onto it to create its schema. However what I am getting is a document element encapsulating the actual...
0
by: Mark Broadbent | last post by:
(firstly sorry Ive cross posted this in C# forum also -I forgot to include this ng) can someone help me? After creating an xml schema file in VS 2003, I drag and drop a table onto it to create...
2
by: pshvarts | last post by:
(I'm new in SOAP) I get some wsdl file (from apache service ). I tried creating SOAP client with .NET - trying to add Web Reference and get error like: "Custom tool error: Unable to import...
1
by: Mikus Sleiners | last post by:
I have a task to create xml document from c# code. I have example of that document should look like and also a xml schema. I wonder if i can use this xml schema somehow ? This is schema: ...
2
by: Moses | last post by:
Hi All, Is is possible to catch the error of an undefined element while creating an object for it. Consider we are not having an element with id indicator but we are trying to make the object...
6
by: rdstevenson | last post by:
Hi, Something I've never come across before and has given me a headache. I have a txt file with content similar to below I want to read in each line do a split on the = and then create a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.