Hi..I have 2 forms in my vb.net windows application. I select a value in form2 and want to populate it in textbox in form1 but its not getting populated. In form2 i have a listbox whose values are binded from db.
Form1:
Form2:Code:Public Class frmNCNpopup Inherits System.Windows.Forms.Form Public FR As frmNCNtest = Nothing <STAThread()> _ Private Shared Sub main() Application.Run(New frmNCNpopup) End Sub Private Sub btn_openchild_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_openchild.Click FR = New frmNCNtest Dim dr As DialogResult = FR.ShowDialog(Me) If dr = DialogResult.OK Then txt_test3.Text = FR.ListBox1.SelectedItem.ToString() End If FR.Dispose() End Sub
When i use selectedindexchanged event in form2, and click on button in form1, then form2 never opens at all.sometimes it shows System.Data.DataRowView in form1 textbox.Code:Public Class frmNCNtest Inherits System.Windows.Forms.Form Public WithEvents ListBox1 As System.Windows.Forms.ListBox Private Sub btn_submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_submit.Click Me.Close() End Sub
How can i select a value from listbox in form2 and show it in textbox in form1?Code:Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Me.Close() End Sub
Thanks.
Something like
Code:textbox1=Form2.Listbox1.SelectedItem
imacooknotachef.com
Food/Photo Blog
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks