• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1072
  • Last Modified:

char data type in VB6


Hi,

I have a variable called mBedname. In VB, it seems that char does not exists...only string..Is it true?

Thanks
0
TungVan
Asked:
TungVan
1 Solution
 
TimCotteeCommented:
Hi TungVan,

Yes, the String data type is valid in VB for all char/varchar values. You can declare it as fixed length or variable using:

Dim strFixed As String * 16 ' gives a 16 char string
Dim strVariable As String ' gives you pretty much as much as your memory can hold

Tim Cottee
0
 
RainUKCommented:
yes there is no char variable. Although you can do a byte or byte array to represent the char. Although why?
0
 
Carl TawnSystems and Integration DeveloperCommented:
Yup. You have to use string but you can work with it as if it was a char. If you want to you can even create a string with a fixed length of 1 character, which is essentially a char.

i.e.

    Dim mBedname As String * 1
    mBedname = "a"


Hope this helps.
0
 
Carl TawnSystems and Integration DeveloperCommented:
Doh! A bit slow.
0
 
TungVanAuthor Commented:


thanks..
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now