PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Why my ListBox doesn't work??
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Why my ListBox doesn't work??
![]() |
Why my ListBox doesn't work?? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I setup a Form and call another class (e.g. class1.cs). (class1.cs) contains
a command to call back the Form to display a string variable on the listbox. However, it doesn't works. The listbox gets no response. Command: listBox.Items.Add( str ); However, it works when i type "MessageBox.Show( str);". A correct string displays in the popup message box. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Dear Questions,
A small code snippet goes a long way towards helping others to understand what is it you are doing wrong -- Alex Feinman --- Visit http://www.opennetcf.org "questions" <questions@discussions.microsoft.com> wrote in message news:AA18E957-10EE-4943-A9A7-B1E8540BB0D9@microsoft.com... >I setup a Form and call another class (e.g. class1.cs). (class1.cs) >contains > a command to call back the Form to display a string variable on the > listbox. > However, it doesn't works. The listbox gets no response. > Command: > listBox.Items.Add( str ); > > However, it works when i type "MessageBox.Show( str);". A correct string > displays in the popup message box. |
|
|
|
#3 |
|
Guest
Posts: n/a
|
////class1.cs
form1.display ( display_message ); ////Form1.cs public void display(string dis_m) { MessageBox.Show(dis_m); listBox.Items.Add("dis_m"); } /*Message dialog is shown correctly, but the listbox keeps empty, why?*/ "Alex Feinman [MVP]" wrote: > Dear Questions, > A small code snippet goes a long way towards helping others to understand > what is it you are doing wrong > > -- > Alex Feinman > --- > Visit http://www.opennetcf.org > "questions" <questions@discussions.microsoft.com> wrote in message > news:AA18E957-10EE-4943-A9A7-B1E8540BB0D9@microsoft.com... > >I setup a Form and call another class (e.g. class1.cs). (class1.cs) > >contains > > a command to call back the Form to display a string variable on the > > listbox. > > However, it doesn't works. The listbox gets no response. > > Command: > > listBox.Items.Add( str ); > > > > However, it works when i type "MessageBox.Show( str);". A correct string > > displays in the popup message box. > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
//class1.cs
display ( display_message ); //Form1.cs public void display(string dis_m) { MessageBox.Show(dis_m); listBox.Items.Add(dis_m); } /*Message Dialog display correctly, but the listbox is still empty. Please help me*/ "Alex Feinman [MVP]" wrote: > Dear Questions, > A small code snippet goes a long way towards helping others to understand > what is it you are doing wrong > > -- > Alex Feinman > --- > Visit http://www.opennetcf.org > "questions" <questions@discussions.microsoft.com> wrote in message > news:AA18E957-10EE-4943-A9A7-B1E8540BB0D9@microsoft.com... > >I setup a Form and call another class (e.g. class1.cs). (class1.cs) > >contains > > a command to call back the Form to display a string variable on the > > listbox. > > However, it doesn't works. The listbox gets no response. > > Command: > > listBox.Items.Add( str ); > > > > However, it works when i type "MessageBox.Show( str);". A correct string > > displays in the popup message box. > > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Are you sure it's the right listbox? Also, not that it changes anything
significantly, but you have quotes around dis_m in the call to ListBox.Items.Add -- Alex Feinman --- Visit http://www.opennetcf.org "questions" <questions@discussions.microsoft.com> wrote in message news:F010AD70-006A-4064-8DED-CC5DB0F9FC6C@microsoft.com... > ////class1.cs > form1.display ( display_message ); > ////Form1.cs > public void display(string dis_m) > { > MessageBox.Show(dis_m); > listBox.Items.Add("dis_m"); > } > > /*Message dialog is shown correctly, but the listbox keeps empty, why?*/ > > "Alex Feinman [MVP]" wrote: > >> Dear Questions, >> A small code snippet goes a long way towards helping others to understand >> what is it you are doing wrong >> >> -- >> Alex Feinman >> --- >> Visit http://www.opennetcf.org >> "questions" <questions@discussions.microsoft.com> wrote in message >> news:AA18E957-10EE-4943-A9A7-B1E8540BB0D9@microsoft.com... >> >I setup a Form and call another class (e.g. class1.cs). (class1.cs) >> >contains >> > a command to call back the Form to display a string variable on the >> > listbox. >> > However, it doesn't works. The listbox gets no response. >> > Command: >> > listBox.Items.Add( str ); >> > >> > However, it works when i type "MessageBox.Show( str);". A correct >> > string >> > displays in the popup message box. >> >> >> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

