Saturday, March 24, 2012

Listbox - identifying different values with a selected row

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

DanOn Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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" wrote:

Quote:

Originally Posted by

On Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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


On Apr 20, 1:36 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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

Quote:

Originally Posted by

On Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Button


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Thank you


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Dan


>

Quote:

Originally Posted by

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" wrote:

Quote:

Originally Posted by

On Apr 20, 1:36 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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

"Alexey Smirnov" wrote:

Quote:

Originally Posted by

On Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:
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


Quote:

Originally Posted by

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


Quote:

Originally Posted by

Button


Quote:

Originally Posted by

Thank you


Quote:

Originally Posted by

Dan


Quote:

Originally Posted by

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


On Apr 20, 1:58 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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" wrote:

Quote:

Originally Posted by

On Apr 20, 1:36 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

"Alexey Smirnov" wrote:
On Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:
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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Button


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Thank you


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Dan


>

Quote:

Originally Posted by

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

Quote:

Originally Posted by

- Show quoted text -


>

Quote:

Originally Posted by

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" wrote:

Quote:

Originally Posted by

On Apr 20, 1:58 pm, Daniel <Dan...@.discussions.microsoft.comwrote:

Quote:

Originally Posted by

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" wrote:

Quote:

Originally Posted by

On Apr 20, 1:36 pm, Daniel <Dan...@.discussions.microsoft.comwrote:
It is not working, maybe it is because i am using vb.net. Can you help me
please.


Quote:

Originally Posted by

"Alexey Smirnov" wrote:
On Apr 19, 5:26 pm, Daniel <Dan...@.discussions.microsoft.comwrote:
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


Quote:

Originally Posted by

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


Quote:

Originally Posted by

Button


Quote:

Originally Posted by

Thank you


Quote:

Originally Posted by

Dan


Quote:

Originally Posted by

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


Quote:

Originally Posted by

- Show quoted text -


Quote:

Originally Posted by

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

0 comments:

Post a Comment