| View previous topic :: View next topic |
| Author |
Message |
computerreality Newbie
Joined: 13 May 2004 Posts: 1
|
Posted: May 13th, 2004 06:38 PM Post subject: HELP! |
|
|
[vb:1:18eb989224]Option Explicit
Dim char(37) As String
Dim mess As String
Dim ctr, ctrb As Integer
Private Sub cmdStart_Click()
Dim FSO As New FileSystemObject
Dim txtFile As File
Dim txtStream As TextStream
cmdStart.Enabled = False
cmdStop.Enabled = True
cmdStart.Caption = "Please Wait!"
Set txtFile = FSO.CreateTextFile("myfile.txt", True)
Set txtStream = txtFile.OpenAsTextStream(ForWriting)
For ctrb = 0 To 35
For ctr = 0 To 35
txtStream.WriteLine (ctr)
Next ctr
txtStream.Write (ctrb)
Next ctrb
txtStream.Close
End Sub
Private Sub cmdStop_Click()
cmdStart.Enabled = True
cmdStop.Enabled = False
cmdStart.Caption = "Start"
End Sub
Private Sub Form_Load()
For ctr = 0 To 9
char(ctr) = Chr(ctr + &H30)
Next ctr
For ctr = 65 To 91 'A to Z
char(ctr - 55) = Chr(ctr)
Next ctr
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub[/vb:1:18eb989224]
getting a type mi-smatch error, anyone know why |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Jul 29th, 2004 04:32 AM Post subject: |
|
|
On which line does this happen? _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
CheatKing64 Freshman

Joined: 06 Aug 2004 Posts: 32 Location: The US of A
|
Posted: Aug 18th, 2004 03:15 PM Post subject: |
|
|
dunno if this would cause a type mismatch error, but in your variable declarations (and I'm assuming VB.NET is similar in syntax to VB6) at the top of the code, you have declared ctr as a variant. The line reads:
[vb:1:eca409bf8a]
Dim ctr, ctrb As Integer
[/vb:1:eca409bf8a]
when it should read:
[vb:1:eca409bf8a]
Dim ctr As Integer, ctrb As Integer
[/vb:1:eca409bf8a]
to get the effect. _________________ NCSA Certified in HTML 4.0:
EasyMail POP/SMTP Server:
http://easymail.sourceforge.net |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Aug 23rd, 2004 11:54 AM Post subject: |
|
|
.NET will interpret "Dim a, b as Integer" as "Dim a as Integer, b as Integer". It's one of the new features.
The way the code is layed out indicates to me that the person might be using VB4, 5, or 6 instead of .NET. .NET is not as friendly as VB. The Option and the arrays would not be declared where they are, the Form_Load defaults to having variables passed to it.
What it looks like is they took VB6 code and paste it in VB.NET and expected it to work. _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
|