Using Strings

You can talk about VB programming here

Using Strings

Postby locohacker » Fri Nov 03, 2006 11:06 pm


Well this a newbie question ehhe, but I havent had time to research on it so I gonna need some help if you guys got time :lol:

how do we use string, like my admin bot I use text boxes and for what I hear strings are better.

this is basically what the program does right now it checks a textbox to see if its empty, if its not empty then it will do a function, now I kindna know how I will convert an item to a string I just dont know how I would check for the string to be empty lol :roll:

aigh you can critized me lol but please also give me some tips :wink:
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4364
Joined: Fri Dec 31, 2004 6:59 pm

Postby Ghost » Sat Nov 04, 2006 12:56 am

now, seeing as how im also a noob, this may not be right...but i think it could be...

instead of using
Code: Select all
If Text1.Text = "0" Then
MsgBox "Loco is geh"
End If

try using
Code: Select all
If jew = "0" Then
MsgBox "Loco is geh"
End If


and instead of of using the text boxes to put the information, use the strings
Code: Select all
Dim jew As String

then, when you would normally put Text1.Text to store, lets say, the room title
Code: Select all
jew = "Room Title"
'instead of
Text1.Text = "Room Title"


now, i think thats right, if it made any lick of sense...

-waits for dep to come along and so 'thats not even close Ghost'
Ghost
 

Postby BattleStar-Galactica » Sat Nov 04, 2006 12:57 am

I didn't get what you want do to but you can compare your string variable with vbnullstring if is equal that mean there is nothing in that string.

do you know how is this>>> Dim mystring as string and Dim mystrings() as string

the different between mystring and mystrings is mystrings is an array of string can be resized progammatically(dynamically).
Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby locohacker » Sat Nov 04, 2006 9:01 am

Wait dont get me confuse :lol:

can I do this

Code: Select all
If nameofstring = "o" then
do something
end if
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4364
Joined: Fri Dec 31, 2004 6:59 pm

Postby BattleStar-Galactica » Sat Nov 04, 2006 10:03 am

sure
Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby NinjaCoder » Sat Nov 04, 2006 11:36 am

Ghost wrote:now, i think thats right, if it made any lick of sense...

-waits for dep to come along and so 'thats not even close Ghost'


lol.....how is licking equated with measuring sence.. :lol:
NinjaCoder
 

Postby Ghost » Sat Nov 04, 2006 2:31 pm

wiki it...
Ghost
 

Postby Departure » Sat Nov 04, 2006 11:30 pm

ghost is correct, and namo has showen an array of strings, just like an array of controls (like i used in trigger bot) but the anwser for locohacker is what ghost gave, instead of using a resouce hungry control (textbox) on your form you would use a string instead, thus elliminating the need for a textbox,

You would use a string in a function, just like you already have in ALL of your source codes locohacker, or you can declare a global string and then you can use that string in whole of your project including your modules ect...

asking such questions locohacker makes thinks you dont even know how your own codes work, I think once you have an understanding how your codes work then you can tweak them for better proformance and become a better programmer


If nameofstring = "o" then
do something
end if


you can do that locohacker but like namomachine said, its better to use VbNullstring because its faster

If nameofstring = VbNullstring then
do something
end if
Last edited by Departure on Sun Nov 05, 2006 12:09 am, edited 2 times in total.
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Postby Ponies » Sat Nov 04, 2006 11:56 pm

ZMG NOWAY!
Ponies
BANNED
BANNED
 
Posts: 5322
Joined: Sun Apr 30, 2006 8:59 am

Postby Ghost » Sun Nov 05, 2006 12:30 am

way
Ghost
 


Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests