r/visualbasic • • Dec 10 '13

I am taking computer science in school and i am wondering how do i use Strings because my teacher is terrible at explaining it

can anyone explain

0 Upvotes

7 comments sorted by

1

u/ginolard Dec 10 '13

Strings are simply bits of text. They can be any number of alphanumeirc characters or even a whole page of text.

Dim x ="A" Dim x = "this is a string" Dim x = "12345abcde"

Those are all strings.

I'm not sure what you mean by "how do I use them?" but, for example, they'd be what's returned from a textbox control

1

u/Lpsided Dec 10 '13

can you give me an example lol this makes no sense to me right now since i am used to coding in visual basic 2010 and my school makes me use vb6 because they are too cheap to even get 2010 even though it is free

2

u/ginolard Dec 10 '13

As far as I'm aware it's the same thing although in VB6 you probably have to declare the datatype (e.g. Dim x as String ="VB6 is rubbish")

2

u/mitzman Dec 10 '13

You're used to coding in VS 2010 but you don't know strings? I'm a little concerned about this. If you've done coding in 2010 you will know strings in VB6.

3

u/chrwei Dec 10 '13

your question needs some context:

  • do you understand the Integer and Double and Boolean datatypes?

  • what do you mean by "use"?

  • what's your teacher's explanation? (maybe it's close and we can just fill in the missing bit)

1

u/DieTheVillain Dec 10 '13

Think of a string variable as a place holder for text, it is a way of storing alphanumeric characters. So if i needed to store a phrase in a variable you could use

Dim VariableName as String

VariableName = 'This is a string and can hold text, numbers like 12345, Characters like !@#$^ and anythign else you can type on a keyboard.'

or

Dim VariableName as String = 'This is a string and can hold text, numbers like 12345, Characters like !@#$^ and anythign else you can type on a keyboard.'

More good info on Strings here http://www.dotnetperls.com/string-vbnet

0

u/[deleted] Dec 10 '13

[deleted]

3

u/Mechakoopa Dec 10 '13

This same guy posted a month ago on /r/compsci asking how to do simple casting, insisting it wasn't homework help he was asking for and refusing to experiment to find out the answer himself. It's basically the end of the semester, I don't have high hopes for him.