Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show value in mdichildform.txtbox from another mdichildf
Message
From
30/05/2009 18:47:24
 
 
To
29/05/2009 09:19:58
Vijay Kumar
DNS ERP Pvt Ltd
India
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01397717
Message ID:
01402806
Views:
64
I suspect that your problem is because you're setting the .Text property of the TextBox of one Form from a different Form. That's typically not a good way to handle this sort of scenario (using custom events would be preferable).

But, that said, you can probably have the behavior you want by calling the Application.DoEvents() method after setting the .Text property.

~~Bonnie




>Hi, Bonnie,
>
>In Mdi
> Dim frm As New Form1
> frm.MdiParent = Me
> frm.Show()
>
>
>In form 1
>
>Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
> If e.KeyChar = Convert.ToChar(13) Then
> If conn.State = ConnectionState.Open Then conn.Close()
> conn.Open()
> Dim frmdgvsearch As New form2
> cmd = New SqlCommand("select coll_short_name,coll_id from collegeinfo order by coll_short_name", conn)
> da = New SqlDataAdapter
> da.SelectCommand = cmd
> ds = New Data.DataSet
> da.Fill(ds, "collegeinfo")
>
> frmdgvsearch.DataGridView1.DataSource = ds.Tables("collegeinfo")
> frmdgvsearch.DataGridView1.Columns(0).HeaderText = UCase(frmdgvsearch.DataGridView1.Columns(0).HeaderText)
> frmdgvsearch.DataGridView1.Columns(0).Width = 250 'Len(UCase(frmdgvsearch.DataGridView1.Columns(1).HeaderText))
> frmdgvsearch.DataGridView1.Columns(1).HeaderText = UCase(frmdgvsearch.DataGridView1.Columns(1).HeaderText)
> frmdgvsearch.DataGridView1.Columns(1).Width = 130
> frmdgvsearch.DataGridView1.AdjustedTopLeftHeaderBorderStyle.Right = DataGridViewAdvancedCellBorderStyle.Outset
> frmdgvsearch.DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
> frmdgvsearch.ShowInTaskbar = False
> frmdgvsearch.MdiParent = Me.MdiParent
> frmdgvsearch.Show()
> conn.Close()
> End If
>
> End Sub
>
>
>In form2
>
>Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
> Try
>
> If e.KeyCode = Keys.Enter Then
> Form1.TextBox1.Text = (DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value)
>
> Me.Close()
>
> End If
>
>
>
> If e.KeyCode = Keys.Escape Then
> Me.Close()
> End If
> '----------------------------------------------------------------------------------
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
>
> End Sub
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform