Hi Dennis,
I've checked your code and made some changes to it. The NewTopic method now
only requires one parameter whose which is a form type. I've also sent you
an email with the code.
If anything is unclear, please feel free to let me know.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| Content-Class: urn:content-classes:message
| From: "dennist" <
[email protected]>
| Sender: "dennist" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: RE: forms as arguments in procedures
| Date: Tue, 11 Nov 2003 00:54:47 -0800
| Lines: 184
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOoMXU5XyMQsSgYTRGf7r6K1ysm3g==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:65991
| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| I followed your advice and the testsub definitely sees
| the controls on the calling form. However, there is
| still a problem.
|
| In the button click event procedure that calls the sub, I
| first check that the comboboxes all have selected
| values. For example, below.
|
|
| ElseIf cboDateType.SelectedIndex = -1 Then
| MsgBox("No Date Type is selected.")
| cboDateType.Focus()
| Exit Sub
|
| Public Sub TestFormPass(ByVal frm As
| frmTopicFromStart)
| Dim s As String
| s = CStr(frm.cboDateType.SelectedIndex)
| MsgBox(s)
| End
|
| yet the message box in the called form gives an index of -
| 1.
|
| Something else may be related. I instantiate frmTopic
| from start with dim tfs1 as new frmtopicfromstart.
|
| I put tfs1 into the call to the test sub.
|
| However, when I tried to put frm as tfs1 in the called
| procedure's argument list, I got a message that tfs1 is
| not defined. When I put in frm as frmtopicfrom start it
| was accepted fine.
|
| Any further advice in this never ending soap opera?
|
| thank you for your time.
|
| dennist
| >-----Original Message-----
| >Hi Dennis,
| >
| >It seems that the class name of the form
| is "frmTopicFromStart". To get a
| >good view of all the class names and their members, you
| can use Class View.
| >To enable it, just choose Class View from the View menu.
| Every class in
| >your project will be listed in a tree view.
| >
| >Further more, you have to create an instance of that
| form. If not, the tfs1
| >will become a null reference, because it doesn't points
| a valid object. A
| >NullReferenceException might be throw when you're trying
| to use that
| >object. So we have to create a new instance before using
| it. Your code
| >might have to be look like the following:
| >
| >Dim tfs1 As New frmTopicFromStart
| >ABCProc(tfs1)
| >
| >Kevin Yu
| >=======
| >"This posting is provided "AS IS" with no warranties,
| and confers no
| >rights."
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "dennist" <
[email protected]>
| >| Sender: "dennist" <
[email protected]>
| >| References: <
[email protected]>
| ><
[email protected]>
| ><
[email protected]>
| >| Subject: RE: forms as arguments in procedures
| >| Date: Mon, 10 Nov 2003 20:51:33 -0800
| >| Lines: 78
| >| Message-ID: <
[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcOoD3sFRm1dCn2NQIWVlVCT+RCBlA==
| >| Newsgroups: microsoft.public.dotnet.framework.adonet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:65976
| >| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| >|
| >| Kevin, I sent the project.
| >|
| >| thanks,
| >|
| >| dennist
| >| >-----Original Message-----
| >| >Hi Dennis,
| >| >
| >| >Please try to check if the defination of
| TopicFromStart
| >| is in the same
| >| >namespace as where you call it. If not, please add
| >| namespace before
| >| >TopicFromStart. Like: namespace.TopicFromStart. If
| that
| >| still cannot work,
| >| >is it convenient for you to send your project to my
| mail
| >| box? I'll try my
| >| >best to help you if I can see the code. I think you
| know
| >| my email address.
| >| >
| >| >Kevin Yu
| >| >=======
| >| >"This posting is provided "AS IS" with no warranties,
| >| and confers no
| >| >rights."
| >| >
| >| >--------------------
| >| >| Content-Class: urn:content-classes:message
| >| >| From: "dennist" <
[email protected]>
| >| >| Sender: "dennist" <
[email protected]>
| >| >| References: <082701c3a44c$06267800
|
[email protected]>
| >| >| Subject: forms as arguments in procedures
| >| >| Date: Mon, 10 Nov 2003 01:45:06 -0800
| >| >| Lines: 22
| >| >| Message-ID: <
[email protected]>
| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain;
| >| >| charset="iso-8859-1"
| >| >| Content-Transfer-Encoding: 7bit
| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| V5.50.4910.0300
| >| >| Thread-Index: AcOnb1KV9PKU66iWTgODB/5cOoJnjw==
| >| >| Newsgroups: microsoft.public.dotnet.framework.adonet
| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| Xref: cpmsftngxa06.phx.gbl
| >| microsoft.public.dotnet.framework.adonet:65905
| >| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.adonet
| >| >|
| >| >| The plot thickens.
| >| >|
| >| >| I shouldn't have been using form1 as an argument at
| >| all.
| >| >| The calling form is TopicFromStart.
| >| >|
| >| >| Now, when I do what Kevin just suggested, and
| >| instantiate
| >| >| the form before calling the procedure, I get the
| >| >| following error message.
| >| >|
| >| >| Dim tfs1 As TopicFromStart
| >| >|
| >| >| type 'topicfromstart' is not defined.
| >| >|
| >| >| If I don't instantiate it, and type me in the call
| to
| >| the
| >| >| procedure, I get
| >| >|
| >| >| ByVal frm As topicfromstart
| >| >| type 'topicfromstart' is not defined.
| >| >|
| >| >| Oi ve voi. What to do?
| >| >|
| >| >| dennist
| >| >|
| >| >
| >| >.
| >| >
| >|
| >
| >.
| >
|