3.0 vbcr constant equivalent of VB 4.0 
Author Message
 3.0 vbcr constant equivalent of VB 4.0

In VB 4.0 I can create the following message box:
    msgbox "Hello " & vbcr & "this is the next line"

So how can I do this exact same thing in VB 3.0? I tried creating a
constant ( const vbcr = chr(13)) but this gave a syntax error when
creating the constant. I also don't find it very handy to do it this
way either:
    vbcr = 13
    msgbox "Hello " & chr(vbcr) & "this is the next line".

So I really want to do the msgbox command EXACTLY like example above
for 4.0!



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0

In VB 4.0 I can create the following message box:
    msgbox "Hello " & vbcr & "this is the next line"

So how can I do this exact same thing in VB 3.0? I tried creating a
constant ( const vbcr = chr(13)) but this gave a syntax error when
creating the constant. I also don't find it very handy to do it this
way either:
    vbcr = 13
    msgbox "Hello " & chr(vbcr) & "this is the next line".

So I really want to do the msgbox command EXACTLY like example above
for 4.0!



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0



Quote:
> In VB 4.0 I can create the following message box:
>     msgbox "Hello " & vbcr & "this is the next line"

> So how can I do this exact same thing in VB 3.0? I tried creating a
> constant ( const vbcr = chr(13)) but this gave a syntax error when
> creating the constant. I also don't find it very handy to do it this
> way either:
>     vbcr = 13
>     msgbox "Hello " & chr(vbcr) & "this is the next line".

You cannot put a function on the right hand side of a Const statement (or
the left hand side, for that matter), and Chr()/Chr$() is a function.

Declare vbCrLf as a global variable.  In your app startup:
        vbCrLf = chr$(13) & chr$(10)

Then you can
        MsgBox "Hello" & vbCrlf & "this is the next line."

--


Braun Technology Group      www.brauntech.com
Chicago, IL



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0


Quote:
> So how can I do this exact same thing in VB 3.0?

You can't.

Quote:
> I tried creating a constant ( const vbcr = chr(13)) but this gave a
> syntax error when creating the constant.

You do this:

Global vbCrLf As String * 2

Sub Main
   vbCrLf = Chr$(13) & Chr$(10)
   ...
End Sub

Was that difficult?

--
VB Info: http://home.sn.no/~balchen/vb/visual.htm
FAQ: http://home.sn.no/~balchen/vb/faq.htm
Knowledge Base: http://home.sn.no/~balchen/vb/kb.htm



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0

why don't u try this

Function vbcr() as String
        vbcr =3D Chr$(13)
End If

msgbox "Hello " & vbcr & "this is the next line"

Hope it could be of help to u.

Anthony Ng



Quote:
> In VB 4.0 I can create the following message box:
>     msgbox "Hello " & vbcr & "this is the next line"
>=20
> So how can I do this exact same thing in VB 3.0? I tried creating a
> constant ( const vbcr =3D chr(13)) but this gave a syntax error when
> creating the constant. I also don't find it very handy to do it this
> way either:
>     vbcr =3D 13
>     msgbox "Hello " & chr(vbcr) & "this is the next line".
>=20
> So I really want to do the msgbox command EXACTLY like example above
> for 4.0!
>=20



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0



Quote:
> In VB 4.0 I can create the following message box:
>     msgbox "Hello " & vbcr & "this is the next line"

> So how can I do this exact same thing in VB 3.0? I tried creating a
> constant ( const vbcr = chr(13)) but this gave a syntax error when
> creating the constant. I also don't find it very handy to do it this
> way either:
>     vbcr = 13
>     msgbox "Hello " & chr(vbcr) & "this is the next line".

> So I really want to do the msgbox command EXACTLY like example above
> for 4.0!

How about:

       vbcr$=chr$(13)
       msgbox "Hello " & vbcr$ & "this is the next line"

Actually, I haven't tried it, but you might need:

       vbcrlf$ = chr$(13) + chr$(10)
       msgbox "Hello " & vbcrlf$ & "this is the next line"

--
Peter Hesketh from Mynyddbach, Monmouthshire, UK



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0

Global vbCrLf as string * 2

vbCrLf = Chr$(13) & Chr$(10)

Then use it as you would in VB 4.
--

Larry Serflaten

Direct links to MS Knowledge Base!
-----------------------------------------------------------------------
  Info: http://www.microsoft.com/kb/developr/vb/q105541.htm
16 bit: http://www.microsoft.com/kb/softlib/mslfiles/vbkb16.exe  (5,557
Kbytes)
32 bit: http://www.microsoft.com/kb/softlib/mslfiles/vbkb32.exe (18,837
Kbytes)
-----------------------------------------------------------------------



Sun, 14 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0


Quote:
>In VB 4.0 I can create the following message box:
>    msgbox "Hello " & vbcr & "this is the next line"

>So how can I do this exact same thing in VB 3.0? I tried creating a
>constant ( const vbcr = chr(13)) but this gave a syntax error when
>creating the constant. I also don't find it very handy to do it this
>way either:
>    vbcr = 13
>    msgbox "Hello " & chr(vbcr) & "this is the next line".

>So I really want to do the msgbox command EXACTLY like example above
>for 4.0!

How about this:

(declarations)
Global vbcr As String

Then perhaps in Form_Load ():

vbcr=chr$(13)

Now your first example should work

It is unfortunate that functions such as chr$() cannot be used in constant
declarations in VB3.

Bob



Mon, 15 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0

Merry Christmas!!!

I've attached a little *.BAS module that helps you do what you want.
Essentially, it defines a bunch of VB3 constants that mimic their VBA
counterparts.

To use it, include it in your project and make a single call to
SetVB4Constants when your application starts.

If you ever port to VB4, just drop the module and remove that one call and
you should be good to go.

Hope this helps.



Quote:
> In VB 4.0 I can create the following message box:
>     msgbox "Hello " & vbcr & "this is the next line"

> So how can I do this exact same thing in VB 3.0? I tried creating a
> constant ( const vbcr = chr(13)) but this gave a syntax error when
> creating the constant. I also don't find it very handy to do it this
> way either:
>     vbcr = 13
>     msgbox "Hello " & chr(vbcr) & "this is the next line".

> So I really want to do the msgbox command EXACTLY like example above
> for 4.0!

begin 600 C_vb4.bas
<uuencoded_portion_removed>

`
end


Tue, 16 Mar 1999 03:00:00 GMT  
 3.0 vbcr constant equivalent of VB 4.0

Quote:

>In VB 4.0 I can create the following message box:
>    msgbox "Hello " & vbcr & "this is the next line"
>So how can I do this exact same thing in VB 3.0? I tried creating a
>constant ( const vbcr = chr(13)) but this gave a syntax error when
>creating the constant. I also don't find it very handy to do it this
>way either:
>    vbcr = 13
>    msgbox "Hello " & chr(vbcr) & "this is the next line".

There are two ways:

1.  Make the vbcr a global var and lod it the value you need on
startup (in the sub main, for example).

2.  A better approach in my view:  Create a function called vbCR that
returns a string.

Function vbCR() as String
  vbCR=Chr$(13)
End Function

Then: msgbox "Hello " & vbCR() & "this is the next line"

That way you don't have to worry about side effects or data
corruption.

Rick Clark



Sun, 21 Mar 1999 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Equivalent of a byte-copy in VB 3.0?

2. Help please: VB 3.0 pro to VB 4.0 pro

3. Will VB 3.0 DLLs Overwrite VB 4.0 (32 bit) DLLs

4. Trouble Porting VB 3.0 SQLServer App to VB 4.0 and Oracle

5. Converting VB 3.0 app to VB 4.0

6. update method in vb 3.0 vs vb 4.0

7. VB 3.0 to VB 4.0 problem

8. VB 3.0 vs VB 4.0 16-bit

9. Can VB 4.0 work with VB 3.0 DLLs?

10. VB 4.0 vs VB 3.0

11. VB 3.0 speed vs. VB 4.0 speed

12. VB 3.0 and Vb 4.0 compatability

 

 
Powered by phpBB® Forum Software