|
-
Jan 23rd, 2000, 05:25 AM
#1
Thread Starter
Hyperactive Member
Hi.
What am I doing wrong. I can pass the strings to Form2 if I refer to the strings as Form1.string. But Form2 will also need to process data from other forms, e.g. Form3.
Form2 has a winsock control to send the data to an E-mail address.
Form1: optSelect is the string I'm trying to pass without the Form1. prefix. It's the description of which option button was selected.
Code:
Public txtTo As String
Public txtMsg As String
Public txtSubject As String
Public txtCC As String
Public optSelect As String
Sub cmdSend_Click(Index As Integer)
If optSelect = "" Then
MsgBox ("You must select a discrepancy type.")
Exit Sub
End If
Form2.Show
End Sub
Sub optDiscr_Click(Index As Integer)
If optDiscr(0).Value = True Then
optSelect = "Discrepancy Report - Transfer"
ElseIf optDiscr(1).Value = True Then
optSelect = "Discrepancy Report - Inventory Level"
ElseIf optDiscr(2).Value = True Then
optSelect = "Discrepancy Report - Replenishment"
ElseIf optDiscr(3).Value = True Then
optSelect = "Discrepancy Report - Core Returns"
ElseIf optDiscr(4).Value = True Then
optSelect = "Discrepancy Report - New Defective"
ElseIf optDiscr(5).Value = True Then
optSelect = "Discrepancy Report - Other"
End If
End Sub
Sub txtWhse_Change()
txtWhse.Text = UCase(txtWhse.Text)
End Sub
Form2: All the strings prefaced with Form1. come through ok. The string optSelect doesn't. It shows "Empty" when running in Debug.
Code:
Sub Form_Load()
txtTo = "[email protected]"
txtMsg = "Whse " & Form1.txtWhse & vbCrLf & _
"Name " & Form1.txtName & vbCrLf & vbCrLf & _
"Item " & Form1.txtPart & vbCrLf & vbCrLf & _
"Discrepancy" & vbCrLf & Form1.txtDisc
txtSubject = optSelect
Text1.Text = txtSubject & vbCrLf & _
"To: " & txtTo & vbCrLf & _
txtMsg
End Sub
Again, as always
Thanks,
Al.
------------------
A computer is a tool, not a toy.
<A HREF="mailto:[email protected]
[email protected]">[email protected]
[email protected]</A>
-
Jan 23rd, 2000, 06:10 AM
#2
So Unbanned
strings are only stored in the sub in which they were defined
visual basic sucks... use a label
------------------
DiGiTaIErRoR
-
Jan 23rd, 2000, 06:16 AM
#3
Lively Member
Put the string variable to a module as public
Public StringName as String
bye
-
Jan 23rd, 2000, 06:53 AM
#4
Thread Starter
Hyperactive Member
Civil78,
Thank you.
Simply moving the declarations to a module works perfectly.
Again, Thank you.
Al.
------------------
A computer is a tool, not a toy.
<A HREF="mailto:[email protected]
[email protected]">[email protected]
[email protected]</A>
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
|