How to set default value for char

T

tshad

I can't seem to find anywhere how to set a null value (default) to a char
variable.

I know you typically set a char as:

Dim temp as Char = "a"

But how do you set it to binary 0 (null).

In C# it would be:

char temp = '\0'

Thanks,

Tom
 
T

Tom Shelton

I can't seem to find anywhere how to set a null value (default) to a char
variable.

I know you typically set a char as:

Dim temp as Char = "a"

But how do you set it to binary 0 (null).

In C# it would be:

char temp = '\0'

Thanks,

Tom

dim temp as char = chr(0)
 
T

Tom Shelton

Is that different than:

dim temp as char = ""

Thanks,

Tom

Other then that won't compile with Option Strict On? You do have
Option Strict On don't you?
 
T

tshad

Tom Shelton said:
Other then that won't compile with Option Strict On? You do have
Option Strict On don't you?

I didn't and it didn't compile as you said.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top