Listbox - identifying different values with a selected row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1


1, help, test
2, help2, test2
3, help3, test3

Button

Thank you

Dan
 
Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1

1, help, test
2, help2, test2
3, help3, test3

Button

Thank you

Dan

string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];
 
It is not working, maybe it is because i am using vb.net. Can you help me
please.

Alexey Smirnov said:
Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1

1, help, test
2, help2, test2
3, help3, test3

Button

Thank you

Dan

string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];
 
It is not working, maybe it is because i am using vb.net. Can you help me
please.



string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];- Hide quoted text -

- Show quoted text -

Dim lb As String = ListBox1.SelectedValue
Dim s() As String = lb.Split(",")
TextBox1.Text = s(0)
 
Thank you for your help, it is working now. I need one more help, the list
box has got a multiple selection property, so if multiple value are selected,
how can i get the first value for each select value?

Thank you

Dan

Alexey Smirnov said:
It is not working, maybe it is because i am using vb.net. Can you help me
please.



Alexey Smirnov said:
Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1
1, help, test
2, help2, test2
3, help3, test3

Thank you

string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];- Hide quoted text -

- Show quoted text -

Dim lb As String = ListBox1.SelectedValue
Dim s() As String = lb.Split(",")
TextBox1.Text = s(0)
 
Thank you for your help, it is working now. I need one more help, the list
box has got a multiple selection property, so if multiple value are selected,
how can i get the first value for each select value?

Thank you

Dan



Alexey Smirnov said:
It is not working, maybe it is because i am using vb.net. Can you help me
please.
:
Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1
1, help, test
2, help2, test2
3, help3, test3
Button
Thank you
Dan
string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];- Hide quoted text -
- Show quoted text -
Dim lb As String = ListBox1.SelectedValue
Dim s() As String = lb.Split(",")
TextBox1.Text = s(0)- Hide quoted text -

- Show quoted text -


Dim i As ListItem

For Each i In ListBox1.Items
If i.Selected Then
Dim lb As String = i.Value
Dim s() As String = lb.Split(",")
TextBox1.Text &= s(0)
End If
Next
 
Thank you very much. You dont realise how you helped me today.

Alexey Smirnov said:
Thank you for your help, it is working now. I need one more help, the list
box has got a multiple selection property, so if multiple value are selected,
how can i get the first value for each select value?

Thank you

Dan



Alexey Smirnov said:
It is not working, maybe it is because i am using vb.net. Can you help me
please.
:
Hello, I need some help, urgently.. I have got a listbox where the
information is retrieved from a database. So for example, if the first row
is selected and the button is pressed, I want just the first field to be
displayed in the text box provided. So if the first one is selected then in
the text box , it should say 1
1, help, test
2, help2, test2
3, help3, test3

Thank you

string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];- Hide quoted text -
- Show quoted text -
Dim lb As String = ListBox1.SelectedValue
Dim s() As String = lb.Split(",")
TextBox1.Text = s(0)- Hide quoted text -

- Show quoted text -


Dim i As ListItem

For Each i In ListBox1.Items
If i.Selected Then
Dim lb As String = i.Value
Dim s() As String = lb.Split(",")
TextBox1.Text &= s(0)
End If
Next
 
Back
Top