cpopham Posted April 28, 2004 Posted April 28, 2004 I have a list box on my form. The settings are as follows: DataSource: NumberDataSet1 DisplayMember: Table.ReqNum ValueMember: Table.ReqNum I am not binding the selected item to anything as I want to assign the selected item to a variable to use as a parameter later. My problem is that when I run the app, the form comes up fine, but the listbox is blank. What am i doing wrong here. Why is the listbox empty? Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Moderators Robby Posted April 28, 2004 Moderators Posted April 28, 2004 what is the value of Table.ReqNum? Quote Visit...Bassic Software
Arch4ngel Posted April 28, 2004 Posted April 28, 2004 if( !this.IsPostBack ) { Listbox1.DataBind(); //Your codes } Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
cpopham Posted April 28, 2004 Author Posted April 28, 2004 Robby: The value? It is a list of requisitions in the database. I tested the dataset and it is working correctly. Arch4ngel: Do I put code that in the Form Load Event? Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Arch4ngel Posted April 28, 2004 Posted April 28, 2004 I usually put it in Page_Load if I'm in Web or Form Load if I'm in Forms. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
Moderators Robby Posted April 28, 2004 Moderators Posted April 28, 2004 Yes the value, it must be a string value of the field name. Quote Visit...Bassic Software
cpopham Posted April 28, 2004 Author Posted April 28, 2004 It does not recognize databind, but I saw something about LoadDataSet and I can not get this to work either.... hmmm..... Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Administrators PlausiblyDamp Posted April 28, 2004 Administrators Posted April 28, 2004 Is this a windows app? If so then you will not need either the DataBind or the Page.IsPostBack bits. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
cpopham Posted April 28, 2004 Author Posted April 28, 2004 Yes windows app and nevermind I see that is a sub procedure which might work. I will try and see.. Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
wessamzeidan Posted April 28, 2004 Posted April 28, 2004 are you making sure that you're filling the dataset if you're using a dataadabter to fill the dataset then place this line of code in your form load event handler yourdataadabter.fill(NumberDataSet1) Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.