|
-
Jan 4th, 2006, 06:17 AM
#1
Thread Starter
Addicted Member
Events
I have a solution with multiple projects, one project has a sql querie form in it, when the user builds up the query, I want to be able to pass the query back to the calling form, although I can access the sending form through reference I cannot access any controls on the form or any events, some code I have tried is below, grateful for any advice. Thanks
VB Code:
Public Class frmquerie
Inherits System.Windows.Forms.Form
Event GetSqlStatement()
blah blah
Private Sub btnexecute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexecute.Click
RaiseEvent GetSqlStatement()
_GetSqlString = txtsqlstring.Text
MsgBox(getsqlstring.ToString)
End Class
On the other form
Public Class frmcolours
Inherits System.Windows.Forms.Form
Dim WithEvents _frmquerie As New common.frmquerie
Private Sub getthesql() Handles _frmquerie.GetSqlStatement
TextBox1.Text = _frmquerie.getsqlstring
End Sub
Last edited by RobDog888; Jan 7th, 2006 at 03:10 PM.
Reason: Added [vbcode] tags
-
Jan 7th, 2006, 02:54 PM
#2
Re: Events
You seem to be mixing up several concepts together. I wasn't able to understand your code very well at first glance, but you should make the referenced class only return values to the calling class (if at all). Also, when calling a sub, function or event, instead of attempting to access textbox1.text within it, pass it as an argument.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|