Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-2007, 04:17 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
Question VB.Net & VB 6.0 Syntax's

Well i was just reading through a VB.NET book and i saw this one syntax that i was unsure how to convert into VB 6.0 Syntax.

This code is placed in General Declarations (VB.NET):

Quote:
Dim Number1 As Integer = 0
The "= 0" part isn't supported in VB 6.0 so if anyone could help me covert the code into VB 6.0 form it would be nice .

Thanks in advance.
__________________
Quote:
The pacifist's task today is to find a method of helping and healing which provides a revolutionary constructive substitute for war.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-17-2007, 07:03 AM
kkelly's Avatar   
kkelly kkelly is offline
Learning Programmer
 
Join Date: Sep 2007
Posts: 50
Rep Power: 4
kkelly is on a distinguished road
Default

It's been a little while since I worked with the VB 6 compiler, but I think the problem is that you can't assign a value to a variable outside of a method (function or sub), unless it is a constant.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-18-2007, 12:46 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
Default

So how would i go about writing the code in VB 6.0?
__________________
Quote:
The pacifist's task today is to find a method of helping and healing which provides a revolutionary constructive substitute for war.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-18-2007, 10:00 AM
TcM's Avatar   
TcM TcM is offline
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,360
Rep Power: 67
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

If I'm not wrong it would be
In the General Declerations Write:
VB Code:
  1. Dim Number1 As Integer

And in the Form_Load() Write:

VB Code:
  1. Number1=0

Simple
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-18-2007, 03:13 PM
o0TheNerd0o's Avatar   
o0TheNerd0o o0TheNerd0o is offline
Learning Programmer
 
Join Date: Sep 2007
Location: I.E. So-cal
Age: 22
Posts: 61
Rep Power: 4
o0TheNerd0o is on a distinguished road
Send a message via AIM to o0TheNerd0o
Default

It doesn't matter where you Dimension the variable. You can't assign a value to it. Unless you dimension as follows:

Const VariableName as Integer = 10

If you don't want it to be constant, this is the correct method:

Dim VariableName as Integer
VariableName = 10

You can use either method in the General Declarations, or under sub or function. Hope this helps.
__________________
Option Explicit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 09-20-2007, 02:59 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
Default

Umm, when i put:
Dim VariableName As Integer
VariableName = 10

It comes up with an error when i press play.
the error says "Compile Error: Invalid outside procedure"
__________________
Quote:
The pacifist's task today is to find a method of helping and healing which provides a revolutionary constructive substitute for war.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-20-2007, 04:18 AM
TcM's Avatar   
TcM TcM is offline
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,360
Rep Power: 67
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Quote:
Originally Posted by travy92 View Post
Umm, when i put:
Dim VariableName As Integer
VariableName = 10

It comes up with an error when i press play.
the error says "Compile Error: Invalid outside procedure"
Of course, the VariableName = 10 should be put as I told you in my post, under Form_Load() so it is set to 10 as soon as the application starts.. but heh, he thinks he is an expert
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 09-20-2007, 06:25 AM
travy92's Avatar   
travy92 travy92 is offline
Learning Programmer
 
Join Date: Sep 2007
Location: Australia
Age: 15
Posts: 71
Rep Power: 4
travy92 is on a distinguished road
Send a message via MSN to travy92
Default

Ahh! TheComputerMaster thanks very much. I followed your instructions and it worked .
Now i need to find out how to change this code:
Quote:
Date.Now.AddMinutes(Difference1*60 _
- Difference2*60)
Into VB 6.0 syntax from VB.NET

Any help?
__________________
Quote:
The pacifist's task today is to find a method of helping and healing which provides a revolutionary constructive substitute for war.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 09-20-2007, 10:46 AM
o0TheNerd0o's Avatar   
o0TheNerd0o o0TheNerd0o is offline
Learning Programmer
 
Join Date: Sep 2007
Location: I.E. So-cal
Age: 22
Posts: 61
Rep Power: 4
o0TheNerd0o is on a distinguished road
Send a message via AIM to o0TheNerd0o
Default

I never said I was anything. I feel like I'm repeating myself... I remember in another post I was explaining to you that I wasn't "1337" either. So yeah, you got me this one time. YAY! You're better than me now. Good job!
__________________
Option Explicit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 09-20-2007, 04:31 PM
TcM's Avatar   
TcM TcM is offline
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,360
Rep Power: 67
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Quote:
Originally Posted by travy92 View Post
Ahh! TheComputerMaster thanks very much. I followed your instructions and it worked .
Now i need to find out how to change this code:


Into VB 6.0 syntax from VB.NET

Any help?
Well explain what that is supposed to do, and perhaps we may be able to help you.

TheNerd, if that is not sarcasm, then thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
vB Weekly Stats Version 1.7 Jordan Community Projects 51 02-11-2008 11:25 AM
Need a program created in VB.Net Thomas Request Services (Paid) 0 08-29-2007 06:02 PM
VB 6.0 or VB.Net mandriva Visual Basic Programming 8 07-30-2007 05:40 PM
VB 6.0: Tutorial, Explaining the VB 6.0 GUI TcM VB Tutorials 1 05-18-2007 10:25 AM
VB for WINDOWS,LINUX & MAC! TcM Visual Basic Programming 6 12-08-2006 04:12 AM


All times are GMT -5. The time now is 08:29 PM.

Contest Stats

Xav ........ 162.68
Pillager ........ 106
neerlin ........ 100
delia ........ 100
nik68 ........ 100
satrian ........ 100
paranoya90 ........ 100
eriafar ........ 100
chili5 ........ 78.87
morefood2001 ........ 46.41

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 68%

Ads