PDA

Click to See Complete Forum and Search --> : Events


soluga
Jan 4th, 2006, 05:17 AM
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

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

mendhak
Jan 7th, 2006, 01:54 PM
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.