I have an mdi form and I am trying to call a procedure -
"myTest" in the parent from the childform. I am
experimenting using a thread, but the thread is not
releasing the childform. I place a breakpoint in "myTest"
on the parent form and I have a
msgbox("Done here!") on the childform. The program stops
at the breakpoint in "myTest" but does not continue to the
msgbox until after I have finished with "myTest". Here is
what I have in the childform:
----------------------------------------------
Imports System
Imports System.Threading
....
Public Class childfrm
Private Sub btn_Click(...)...
Dim p As New frmParent
Dim t As New Thread(AddressOf p.myTest())
t.Start()
MsgBox("done here!")
End Sub
End Class
------------------------------------------------
"myTest" runs OK, but not reaching msgbox in childform
until "myTest" is done first.
I also get this message in the output window after running
everything:
The thread '<No Name>' (0xb48) has exited with code 0
(0x0).
Am I using the Thread object correctly? Could someone
tell me how to use Threading correctly here?
TIA
Adda 18 1729
Hi,
Why are you creating a new frmparent. Why dont you try
Dim p as frmParent = Me.Parent
Ken
-------------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
Hi,
Why are you creating a new frmparent. Why dont you try
Dim p as frmParent = Me.Parent
Ken
-------------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
Hi Ken,
I actually tried something like that a few days ago but
could not get the correct syntax (still in the migration
process from vb6). So I tried it with your syntax, but I
was having an implicit conversion problem since I had
Option Strict On. So I turned it off. Now I get an error
that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent,
System.Windows.Forms.Form)
but still having problem with specified cast not valid. I
appologize for my newbieness with .Net (just know that I
hate having to go through the amateur phase all over
again :).
Adda -----Original Message----- Hi,
Why are you creating a new frmparent. Why dont
you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint
in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program
stops at the breakpoint in "myTest" but does not continue to
the msgbox until after I have finished with "myTest". Here
is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after
running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Hi Ken,
I actually tried something like that a few days ago but
could not get the correct syntax (still in the migration
process from vb6). So I tried it with your syntax, but I
was having an implicit conversion problem since I had
Option Strict On. So I turned it off. Now I get an error
that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent,
System.Windows.Forms.Form)
but still having problem with specified cast not valid. I
appologize for my newbieness with .Net (just know that I
hate having to go through the amateur phase all over
again :).
Adda -----Original Message----- Hi,
Why are you creating a new frmparent. Why dont
you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint
in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program
stops at the breakpoint in "myTest" but does not continue to
the msgbox until after I have finished with "myTest". Here
is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after
running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Hello Adda
Try Dim p as NEW frmParent = CType(Me.Parent, System.Windows.Forms.Form)
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
-----Original Message----- Hi,
Why are you creating a new frmparent. Why dont you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Hello Adda
Try Dim p as NEW frmParent = CType(Me.Parent, System.Windows.Forms.Form)
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
-----Original Message----- Hi,
Why are you creating a new frmparent. Why dont you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken
---------------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
-----Original Message----- Hi,
Why are you creating a new frmparent. Why dont you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken
---------------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
-----Original Message----- Hi,
Why are you creating a new frmparent. Why dont you try Dim p as frmParent = Me.Parent
Ken ------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:1a*****************************@phx.gbl... I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a breakpoint in "myTest" on the parent form and I have a msgbox("Done here!") on the childform. The program stops at the breakpoint in "myTest" but does not continue to the msgbox until after I have finished with "myTest". Here is what I have in the childform: ---------------------------------------------- Imports System Imports System.Threading ... Public Class childfrm
Private Sub btn_Click(...)... Dim p As New frmParent Dim t As New Thread(AddressOf p.myTest()) t.Start() MsgBox("done here!") End Sub End Class ------------------------------------------------ "myTest" runs OK, but not reaching msgbox in childform until "myTest" is done first.
I also get this message in the output window after running everything:
The thread '<No Name>' (0xb48) has exited with code 0 (0x0).
Am I using the Thread object correctly? Could someone tell me how to use Threading correctly here?
TIA Adda
.
Well, I tried this but still getting the casting problem.
The only thing that is working here is
Dim p as New frmParent
My goal is to be able to refresh the datagrid in the
parent form from the childform. I'm sure there is a way,
but I just don't have the proficiency yet with vb.net to
intuit how to accomplish this. Maybe API code? It seems
like only adding data to the dataset from the parent form
does the trick. How can I trick the parent form from the
childform? Oh well, back to the drawing board.
But I thank everyone for all the replies and suggestions.
Adda -----Original Message----- Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken --------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but
I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an
error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not
valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
>-----Original Message----- >Hi, > > Why are you creating a new frmparent. Why
dont you try > >Dim p as frmParent = Me.Parent > >Ken >------------------- >"Adda" <an*******@discussions.microsoft.com> wrote in message >news:1a*****************************@phx.gbl... >> I have an mdi form and I am trying to call a
procedure - >> "myTest" in the parent from the childform. I am >> experimenting using a thread, but the thread is not >> releasing the childform. I place a breakpoint in "myTest" >> on the parent form and I have a >> msgbox("Done here!") on the childform. The program stops >> at the breakpoint in "myTest" but does not continue
to the >> msgbox until after I have finished with "myTest".
Here is >> what I have in the childform: >> ---------------------------------------------- >> Imports System >> Imports System.Threading >> ... >> Public Class childfrm >> >> Private Sub btn_Click(...)... >> Dim p As New frmParent >> Dim t As New Thread(AddressOf p.myTest()) >> t.Start() >> MsgBox("done here!") >> End Sub >> End Class >> ------------------------------------------------ >> "myTest" runs OK, but not reaching msgbox in
childform >> until "myTest" is done first. >> >> I also get this message in the output window after running >> everything: >> >> The thread '<No Name>' (0xb48) has exited with code 0 >> (0x0). >> >> Am I using the Thread object correctly? Could
someone >> tell me how to use Threading correctly here? >> >> TIA >> Adda > > >. >
.
Well, I tried this but still getting the casting problem.
The only thing that is working here is
Dim p as New frmParent
My goal is to be able to refresh the datagrid in the
parent form from the childform. I'm sure there is a way,
but I just don't have the proficiency yet with vb.net to
intuit how to accomplish this. Maybe API code? It seems
like only adding data to the dataset from the parent form
does the trick. How can I trick the parent form from the
childform? Oh well, back to the drawing board.
But I thank everyone for all the replies and suggestions.
Adda -----Original Message----- Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken --------------------- "Adda" <an*******@discussions.microsoft.com> wrote in
messagenews:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but
I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an
error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not
valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
>-----Original Message----- >Hi, > > Why are you creating a new frmparent. Why
dont you try > >Dim p as frmParent = Me.Parent > >Ken >------------------- >"Adda" <an*******@discussions.microsoft.com> wrote in message >news:1a*****************************@phx.gbl... >> I have an mdi form and I am trying to call a
procedure - >> "myTest" in the parent from the childform. I am >> experimenting using a thread, but the thread is not >> releasing the childform. I place a breakpoint in "myTest" >> on the parent form and I have a >> msgbox("Done here!") on the childform. The program stops >> at the breakpoint in "myTest" but does not continue
to the >> msgbox until after I have finished with "myTest".
Here is >> what I have in the childform: >> ---------------------------------------------- >> Imports System >> Imports System.Threading >> ... >> Public Class childfrm >> >> Private Sub btn_Click(...)... >> Dim p As New frmParent >> Dim t As New Thread(AddressOf p.myTest()) >> t.Start() >> MsgBox("done here!") >> End Sub >> End Class >> ------------------------------------------------ >> "myTest" runs OK, but not reaching msgbox in
childform >> until "myTest" is done first. >> >> I also get this message in the output window after running >> everything: >> >> The thread '<No Name>' (0xb48) has exited with code 0 >> (0x0). >> >> Am I using the Thread object correctly? Could
someone >> tell me how to use Threading correctly here? >> >> TIA >> Adda > > >. >
.
Hi Adda,
I was curious if this would work.
I think that it does as you wanted?
(Most code is to build the sample table)
Cor
\\\Mdiform
Private Sub FormMdi_Load(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
dt.CreateTable()
Dim frm1 As New Form1
frm1.MdiParent = Me
frm1.Show()
Dim frm2 As New Form2
frm2.MdiParent = Me
frm2.Show()
AddHandler dt.dvchanged, AddressOf myrefresh
End Sub
Private Sub myrefresh()
Me.Refresh()
End Sub
///
\\\2 forms form1 and form2 both the same
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
DataGrid1.DataSource = dt.dv
End Sub
///
\\\Class to build a sample table as and to set the events
Public Class dt
Public Shared WithEvents dv As DataView
Public Shared Event dvchanged()
Public Shared Sub CreateTable()
Dim dt As New DataTable("Sample")
For i As Integer = 0 To 7
Dim dc As New DataColumn(Chr(i + 65))
dt.Columns.Add(dc)
Next
For i As Integer = 0 To 8
dt.Rows.Add(dt.NewRow)
For y As Integer = 0 To dt.Columns.Count - 1
dt.Rows(i)(y) = (Chr(i + 48))
Next
Next
dv = New DataView(dt)
End Sub
Private Shared Sub dv_ListChanged(ByVal sender _
As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) _
Handles dv.ListChanged
RaiseEvent dvchanged()
End Sub
End Class
///
Hi Adda,
I was curious if this would work.
I think that it does as you wanted?
(Most code is to build the sample table)
Cor
\\\Mdiform
Private Sub FormMdi_Load(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
dt.CreateTable()
Dim frm1 As New Form1
frm1.MdiParent = Me
frm1.Show()
Dim frm2 As New Form2
frm2.MdiParent = Me
frm2.Show()
AddHandler dt.dvchanged, AddressOf myrefresh
End Sub
Private Sub myrefresh()
Me.Refresh()
End Sub
///
\\\2 forms form1 and form2 both the same
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
DataGrid1.DataSource = dt.dv
End Sub
///
\\\Class to build a sample table as and to set the events
Public Class dt
Public Shared WithEvents dv As DataView
Public Shared Event dvchanged()
Public Shared Sub CreateTable()
Dim dt As New DataTable("Sample")
For i As Integer = 0 To 7
Dim dc As New DataColumn(Chr(i + 65))
dt.Columns.Add(dc)
Next
For i As Integer = 0 To 8
dt.Rows.Add(dt.NewRow)
For y As Integer = 0 To dt.Columns.Count - 1
dt.Rows(i)(y) = (Chr(i + 48))
Next
Next
dv = New DataView(dt)
End Sub
Private Shared Sub dv_ListChanged(ByVal sender _
As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) _
Handles dv.ListChanged
RaiseEvent dvchanged()
End Sub
End Class
///
Hi,
Dim p as frmParent = DirectCast(Me.MdiParent, frmParent)
Ken
--------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl... Well, I tried this but still getting the casting problem. The only thing that is working here is
Dim p as New frmParent
My goal is to be able to refresh the datagrid in the parent form from the childform. I'm sure there is a way, but I just don't have the proficiency yet with vb.net to intuit how to accomplish this. Maybe API code? It seems like only adding data to the dataset from the parent form does the trick. How can I trick the parent form from the childform? Oh well, back to the drawing board.
But I thank everyone for all the replies and suggestions.
Adda
-----Original Message----- Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken --------------------- "Adda" <an*******@discussions.microsoft.com> wrote in messagenews:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
>-----Original Message----- >Hi, > > Why are you creating a new frmparent. Why dont you try > >Dim p as frmParent = Me.Parent > >Ken >------------------- >"Adda" <an*******@discussions.microsoft.com> wrote in message >news:1a*****************************@phx.gbl... >> I have an mdi form and I am trying to call a procedure - >> "myTest" in the parent from the childform. I am >> experimenting using a thread, but the thread is not >> releasing the childform. I place a breakpoint in "myTest" >> on the parent form and I have a >> msgbox("Done here!") on the childform. The program stops >> at the breakpoint in "myTest" but does not continue to the >> msgbox until after I have finished with "myTest". Here is >> what I have in the childform: >> ---------------------------------------------- >> Imports System >> Imports System.Threading >> ... >> Public Class childfrm >> >> Private Sub btn_Click(...)... >> Dim p As New frmParent >> Dim t As New Thread(AddressOf p.myTest()) >> t.Start() >> MsgBox("done here!") >> End Sub >> End Class >> ------------------------------------------------ >> "myTest" runs OK, but not reaching msgbox in childform >> until "myTest" is done first. >> >> I also get this message in the output window after running >> everything: >> >> The thread '<No Name>' (0xb48) has exited with code 0 >> (0x0). >> >> Am I using the Thread object correctly? Could someone >> tell me how to use Threading correctly here? >> >> TIA >> Adda > > >. >
.
Hi,
Dim p as frmParent = DirectCast(Me.MdiParent, frmParent)
Ken
--------------
"Adda" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl... Well, I tried this but still getting the casting problem. The only thing that is working here is
Dim p as New frmParent
My goal is to be able to refresh the datagrid in the parent form from the childform. I'm sure there is a way, but I just don't have the proficiency yet with vb.net to intuit how to accomplish this. Maybe API code? It seems like only adding data to the dataset from the parent form does the trick. How can I trick the parent form from the childform? Oh well, back to the drawing board.
But I thank everyone for all the replies and suggestions.
Adda
-----Original Message----- Hi,
Dim p as frmParent = CType(Me.Parent, frmParent)
Ken --------------------- "Adda" <an*******@discussions.microsoft.com> wrote in messagenews:15*****************************@phx.gbl... Hi Ken,
I actually tried something like that a few days ago but could not get the correct syntax (still in the migration process from vb6). So I tried it with your syntax, but I was having an implicit conversion problem since I had Option Strict On. So I turned it off. Now I get an error that the specified cast is not valid. So I tried
Dim p as frmParent = CType(Me.Parent, System.Windows.Forms.Form)
but still having problem with specified cast not valid. I appologize for my newbieness with .Net (just know that I hate having to go through the amateur phase all over again :).
Adda
>-----Original Message----- >Hi, > > Why are you creating a new frmparent. Why dont you try > >Dim p as frmParent = Me.Parent > >Ken >------------------- >"Adda" <an*******@discussions.microsoft.com> wrote in message >news:1a*****************************@phx.gbl... >> I have an mdi form and I am trying to call a procedure - >> "myTest" in the parent from the childform. I am >> experimenting using a thread, but the thread is not >> releasing the childform. I place a breakpoint in "myTest" >> on the parent form and I have a >> msgbox("Done here!") on the childform. The program stops >> at the breakpoint in "myTest" but does not continue to the >> msgbox until after I have finished with "myTest". Here is >> what I have in the childform: >> ---------------------------------------------- >> Imports System >> Imports System.Threading >> ... >> Public Class childfrm >> >> Private Sub btn_Click(...)... >> Dim p As New frmParent >> Dim t As New Thread(AddressOf p.myTest()) >> t.Start() >> MsgBox("done here!") >> End Sub >> End Class >> ------------------------------------------------ >> "myTest" runs OK, but not reaching msgbox in childform >> until "myTest" is done first. >> >> I also get this message in the output window after running >> everything: >> >> The thread '<No Name>' (0xb48) has exited with code 0 >> (0x0). >> >> Am I using the Thread object correctly? Could someone >> tell me how to use Threading correctly here? >> >> TIA >> Adda > > >. >
.
Thank you. This is an interesting approach. I did try it
and got a message that an mdiparent can't be a parent and
also a child. I will experiment with this. Here is the
truth. I am taking a class in ADO.net using VB.net (or
C#). The instructor has a solution, but I won't know it
(until it is too late :). The only thing I can really
think of to evoke something in the parent form would be to
show the childform as a dialog form. But I tried that
only to get the message that only top level forms can be
showed as dialog. In the meantime, I can always read the
contents of the childform from a menu on the parent form.
My instructions are not completely clear (to me) but the
idea is that I add data to a dataset on the parent form
but by clicking a button on the childform and on the
update (from the childform) the datagrid gets refreshed
(also from the button click on the childform).
Adda -----Original Message----- Hi Adda,
I was curious if this would work.
I think that it does as you wanted?
(Most code is to build the sample table)
Cor
\\\Mdiform Private Sub FormMdi_Load(ByVal _ sender As Object, ByVal e As System.EventArgs) _ Handles MyBase.Load dt.CreateTable() Dim frm1 As New Form1 frm1.MdiParent = Me frm1.Show() Dim frm2 As New Form2 frm2.MdiParent = Me frm2.Show() AddHandler dt.dvchanged, AddressOf myrefresh End Sub Private Sub myrefresh() Me.Refresh() End Sub /// \\\2 forms form1 and form2 both the same Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load DataGrid1.DataSource = dt.dv End Sub /// \\\Class to build a sample table as and to set the events Public Class dt Public Shared WithEvents dv As DataView Public Shared Event dvchanged() Public Shared Sub CreateTable() Dim dt As New DataTable("Sample") For i As Integer = 0 To 7 Dim dc As New DataColumn(Chr(i + 65)) dt.Columns.Add(dc) Next For i As Integer = 0 To 8 dt.Rows.Add(dt.NewRow) For y As Integer = 0 To dt.Columns.Count - 1 dt.Rows(i)(y) = (Chr(i + 48)) Next Next dv = New DataView(dt) End Sub Private Shared Sub dv_ListChanged(ByVal sender _ As Object, ByVal e As
System.ComponentModel.ListChangedEventArgs) _ Handles dv.ListChanged RaiseEvent dvchanged() End Sub End Class ///
.
Thank you. This is an interesting approach. I did try it
and got a message that an mdiparent can't be a parent and
also a child. I will experiment with this. Here is the
truth. I am taking a class in ADO.net using VB.net (or
C#). The instructor has a solution, but I won't know it
(until it is too late :). The only thing I can really
think of to evoke something in the parent form would be to
show the childform as a dialog form. But I tried that
only to get the message that only top level forms can be
showed as dialog. In the meantime, I can always read the
contents of the childform from a menu on the parent form.
My instructions are not completely clear (to me) but the
idea is that I add data to a dataset on the parent form
but by clicking a button on the childform and on the
update (from the childform) the datagrid gets refreshed
(also from the button click on the childform).
Adda -----Original Message----- Hi Adda,
I was curious if this would work.
I think that it does as you wanted?
(Most code is to build the sample table)
Cor
\\\Mdiform Private Sub FormMdi_Load(ByVal _ sender As Object, ByVal e As System.EventArgs) _ Handles MyBase.Load dt.CreateTable() Dim frm1 As New Form1 frm1.MdiParent = Me frm1.Show() Dim frm2 As New Form2 frm2.MdiParent = Me frm2.Show() AddHandler dt.dvchanged, AddressOf myrefresh End Sub Private Sub myrefresh() Me.Refresh() End Sub /// \\\2 forms form1 and form2 both the same Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load DataGrid1.DataSource = dt.dv End Sub /// \\\Class to build a sample table as and to set the events Public Class dt Public Shared WithEvents dv As DataView Public Shared Event dvchanged() Public Shared Sub CreateTable() Dim dt As New DataTable("Sample") For i As Integer = 0 To 7 Dim dc As New DataColumn(Chr(i + 65)) dt.Columns.Add(dc) Next For i As Integer = 0 To 8 dt.Rows.Add(dt.NewRow) For y As Integer = 0 To dt.Columns.Count - 1 dt.Rows(i)(y) = (Chr(i + 48)) Next Next dv = New DataView(dt) End Sub Private Shared Sub dv_ListChanged(ByVal sender _ As Object, ByVal e As
System.ComponentModel.ListChangedEventArgs) _ Handles dv.ListChanged RaiseEvent dvchanged() End Sub End Class ///
.
Hi Adda,
I did test that sample and did not get an error, did you set the mdi = true
in the mdi form that I did using the designer?
Cor
Hi Adda,
I did test that sample and did not get an error, did you set the mdi = true
in the mdi form that I did using the designer?
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: AMS |
last post by:
I am trying to create a thread to execute a script for me and then
display the output in notepad.
What is happening is when I call the CreateThread method and pass in
the Routine and Parameter...
|
by: me |
last post by:
I have a Class Library that contains a Form and several helper classes. A
thread gets created that performs processing of data behind the scenes and
the Form never gets displayed (it is for debug...
|
by: SamIAm |
last post by:
Hi am creating a email application that needs to mail out a very large
amount of emails. I have created a multithreaded c# application that using
message queuing. I have created a threadpool of 5...
|
by: MechSoft |
last post by:
Hi, there,
I have a multi-threaded non-MFC program that will include a regular dll
which would be part of the user interface, possibly a dialog based interface.
I would prefer to have the user...
|
by: Markus Prediger |
last post by:
Hi NG,
I have an asp.net project that uses an vb6 com object for some
database-manipulation (I cannot rewrite it in .net, sorry, its not my
decision).
I want it to be instanciated seperately...
|
by: Roemer |
last post by:
Hi all
I stumbled over a new problem:
I have a programm with just a class that is asynchronous listening for
network connections. As soon as someone connected, a new form needs to be
created....
|
by: Erakis |
last post by:
Hi,
I have to make an ActiveX (Running on Internet Explorer) that
play/record sound from soundcard. Also, I have to create a Socket to
send/receive sound data to my server.
I use this...
|
by: raylopez99 |
last post by:
Keep in mind this is my first compiled SQL program Stored Procedure
(SP), copied from a book by Frasier Visual C++.NET in Visual Studio
2005 (Chap12). So far, so theory, except for one bug...
|
by: =?Utf-8?B?QmFydE1hbg==?= |
last post by:
Greetings,
To begin with we have an archetecture which has a manager Asssembly which
loads "Plug-in" assemblies using reflection, when a the UI prompts the
manager.
This loading of the...
|
by: jarea |
last post by:
I have read quite a bit about this error but I have yet to find the solution to my problem.
I am trying to execute the following mysql statement:
alter table line_items
add...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |