ListItem class not available in VB.NET

ellen

Member
Joined
Aug 20, 2005
Messages
6
Programming Experience
Beginner
HI,

i download visual studio 2005 express edition beta software and explore it and try it..

i add
Dim
test As ListItem

Error displays saying that Listitem is not defined...i m puzzled
how to resolve it?

hope to hear from you soon.
thanks
regards
friend
 
Which Express Edition are you using? ListItem is a member of the System.Web.UI.WebControls namespace, so I assume you are creating a Web Forms app. Are you using Visual Basic Express or Visual Web Developer Express, because Visual Basic is only for Windows Forms.
 
Hi,
Thanks for your reply.

I download it from internet. It is Visual Basic 2005 Express Edition Beta 2.
I m creating small windows form application.

What i need is to read through records in database and retrieve field names and put them into combo to display when the user clicks on drop down on combo?

get what i mean?

Don't tell me Visual Basic 2005 Express Edition Beta 2 lacks web controls?
I add reference for system and system.web and system.web.dll but cannot find system.web.dll in reference.
I am puzzled..



regards
ellen
 
Like I said, the ListItem is a WebControl. Visual Basic 2005 is for creating Windows Forms applications, while Visual Web Developer 2005 is for creating Web Forms applications. You cannot put a Web control on a Windows form and you cannot put a Windows control on a Web form. You can only add objects that are derived from the System.Windows.Forms.Control class to the Controls collection of a Windows form, and Web controls do not inherit that class.
 
Resolved

Hello jmcilhinney

i m creating windows forms but use combo drop down list to retrieve data from database and data put into combo to display while clicking on drop down list by user..

since listitem not available in windows.form , so i add web reference, web reference and find system.web issnt it?

after that, i type 3 things :
imports system
imports system.web
imports system.web.UI.webcontrols

will it be all right?

regards
ellen
 
DO NOT mix Windows Forms and Web Forms. They are two different things for two different purposes. A Web Forms ListItem has nothing whatsoever to do with a Windows Forms ComboBox. If you want to display items in a System.Windows.Forms.ComboBox you either use Combox.Items.Add or you can bind a DataTable, or some other object, directly to the ComboBox using the ComboBox.DataSource property. I repeat, DO NOT mix Windows Forms and Web Forms.
 
hi sir,

oh i see..ok noted

btw i notice there are no oledbconnection,oledbcommand,oledbadapter icons under Data category in Visual Basic 2005 Express Edition beta 2 software...

in Microsoft Visual Studio. Net 2003 environment, there are oledbconnection,oledbcommand,oledbadapter icons available under data category..

so where can i find icons in visual basic 2005 environment? it seems i m confused in 2005 than 2003?

no diffference if i use .net 2003 instead of 2005? in 2005, i m really confused
if i use in 2005, it means program in 2005 cannot be opened in 2003 issnt it?


regards
ellen
 
VB 2005 targets version 2.0 of the .NET Framework, which has additional functionality over version 1.1. Also, 2005 projects have a different format to 2003, so no you cannot open 2005 projects in 2003. As for OleDbConnection, etc., they still exist and you can still use them the same way you did before. The only difference is that they do not appear in the Toolbox by default. You can add them easily enough by right-clicking the Toolbox window, but I believe there is the TableAdapter class that incorporates and simplifies much of the same functionality. I've never used that class myself so I can't tell you more than that.
 
Back
Top