Return to index: [Subject] [Thread] [Date] [Author]

RE: Visual Basic question

[Subject Prev][Subject Next][Thread Prev][Thread Next]
Looks to me like you only open the output file if I=1 and you close it each time you do not have the check box selected.  The dimension statement you have in the front also is calling AA, BB, and CC as variants... would be better to make them doubles, singles, or text as requried.  Should make sure the CmnDialog1.BasesData returns a valid filename also.
Greg Effland
-----Original Message-----
From: Greg Smith [mailto:strusup(--nospam--at)]
Sent: Monday, May 14, 2001 9:06 AM
To: seaint
Subject: Visual Basic question

Anyone on the list that knows Visual Basic 6.......What is wrong with the following code?  (The change of bases works fine but the Print is where I'm getting a runtime error).
Dim AA, BB, CC, Rythm As Double
Dim i As Integer
Option Base 1
Private Sub cmdExit1_Click()
End Sub
Private Sub cmdCompute_Click()
If i = 1 Then
Open CmnDialog1.BasesData For Output As #1
Else: i = i + 1
End If
AA = Num1.Text
BB = Newbase.Text
Rythm = Log(AA) / Log(BB)
CC = 10# ^ Rythm
Newnum.Text = CC
If Check1.Value Then
Print #1, Num1.Text; Newbase.Text; Newnum.Text
Else: Close #1
End If
End Sub
TIA,  Greg