char data type in VB6

Posted on 2005-04-14
Last Modified: 2008-03-17


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

Question by:TungVan
    LVL 44

    Accepted Solution

    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
    LVL 5

    Expert Comment

    yes there is no char variable. Although you can do a byte or byte array to represent the char. Although why?
    LVL 52

    Expert Comment

    by:Carl Tawn
    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.


        Dim mBedname As String * 1
        mBedname = "a"

    Hope this helps.
    LVL 52

    Expert Comment

    by:Carl Tawn
    Doh! A bit slow.

    Author Comment



    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now