your question seems a bit vague? Can you elaborate a bit? How are you reading the data from your database, and what is this "textbox of front end" you speak of?
To get the selected item of a listbox you can try using the selectedItem property, like
ListBox1.SelectedItem
'another way is to get it from the Items collection using an index, like:
ListBox1.Items(ListBox1.SelectedIndex)
i like this coding but if i use this code then only selected item of listbox will display
like
eg: textbox1.text = listbox1.SelectedItem
but i want suppose my backend contain field emp_id,emp_name and other detail then in front end i have design text box for that fields and i am adding record in database using front end add button and textbox1.text is the emp_id then value of textbox1 want to display in listbox1 for that i have done coding listbox1.Items.Add(textbox1.text) then whatever emp_id add in textbox that inserted in backend also and in listbox also then i clear textboxes using textbox1.text = "" method then again add second record using add button then when i click the listbox1 item that is first item then selected item want to match with database and other detail of that selected item(emp_id) should display again in textbox so which object i take to reffer database like we do in vb
selected item want to match with database and other detail of that selected item(emp_id) should display again in textbox so which object i take to reffer database like we do in vb
I am sorry, i can barley understand what you wrote, (i took a quick look at your bpo software solution, but i dont have time to go through it) but i think i got an idea of what your trying to do?
Basically, you want your listbox to be filled with data from a column of a table from an database. When an item is selected on the listbox you want the corresponding data from a different column of the same row to show up in the textbox, right?
if you do not want to bind the data members to the textboxes and you want to do it on a button click or when the selected index is changed you can do something like...
'instead of binding like:
'TextBox1.DataBindings.Add("text", dt, "COLUMNNAME")
'in the selectedindexchanged or other event you can do something like:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim drv = CType(ListBox1.SelectedItem(), DataRowView) 'note that in order for this to work the items in the listbox should be of type DataRowView, which is what would happen if you set the listbox DataSource property to a DataTable like shown in the example in the link above
TextBox1.Text = drv.Row("COLUMNNAME").ToString()
End Sub
hope that helps... I don't know too much about the database aspect, if you have more questions with regards to databases maybe someone else on here can help you. if it is more aimed toward databases maybe you can also try posting in the Database Topic or such Database General Discussion rather than the Windows Forms.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.