Listbox - identifying different values with a selected row

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
 
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

string lb = ListBox1.SelectedValue;
string[] s = lb.Split(',');
TextBox1.Text = s[0];
 
G

Guest

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

Anon User 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];
 
G

Guest

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)
 
G

Guest

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

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



Anon User 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)
 
G

Guest

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



Anon User 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
 
G

Guest

Thank you very much. You dont realise how you helped me today.

Anon User 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



Anon User 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top