What's new

VB tips

GuestX

New member
i finished the book for VB. ( it was for kids)
i´ll code a programm to translate Albanian to other
languages but how can i code when the User writes
HelLO , it comes same how Hello or hello ???

P.S SRY 4 MY ENGLISH
 

Doomulation

?????????????????????????
Be more specific, but as how vb works is that it does not change the case. The text should come out exacly as you write it unless you manipulate it with some functions yourself.
 

icepir8

Moderator
SculleatR said:
i finished the book for VB. ( it was for kids)
i´ll code a programm to translate Albanian to other
languages but how can i code when the User writes
HelLO , it comes same how Hello or hello ???

P.S SRY 4 MY ENGLISH

Use the UCASE or LCASE functions.

UCASE("HelLo") returns "HELLO".
LCASE("HelLo") returns "hello"
 

tbag

New member
oh

I thought he ment like on KeyPress ASCII the combinations in ASCII msgbox "Hello!" ^_^
 
SculleatR said:
i finished the book for VB. ( it was for kids)
i´ll code a programm to translate Albanian to other
languages but how can i code when the User writes
HelLO , it comes same how Hello or hello ???

P.S SRY 4 MY ENGLISH

theres gonna be a lot of word checking, then grammar involved, and to say u dont kno english that well from the sound of ur post are you sure its worth it?
 

Eagle

aka Alshain
Moderator
Translations are a lot more complex than you think, you sure your up for that kind of job? Its not just a matter of taking one word and moving it to another, as sytaylor said, there is grammar and context, and such.
 
OP
G

GuestX

New member
i don´t now how to use LCASE or UCASE but my Code currently:
(Like)


If txt1.Text = "Hello" Or txt1.Text = "hello" Then
txt2.Text = "Hallo"
ElseIf....
(Other Words)...
(and finally if the word was not found)
Else
MsgBox "Word was not found"
End If
 

Eagle

aka Alshain
Moderator
SculleatR said:
i don´t now how to use LCASE or UCASE but my Code currently:
(Like)


If txt1.Text = "Hello" Or txt1.Text = "hello" Then
txt2.Text = "Hallo"
ElseIf....
(Other Words)...
(and finally if the word was not found)
Else
MsgBox "Word was not found"
End If

Code:
If ucase(txt1.Text) = "HELLO" Then
txt2.Text = "Hallo"
ElseIf....
(Other Words)...
(and finally if the word was not found)
Else
MsgBox "Word was not found"
End If
 

Eagle

aka Alshain
Moderator
For multiple words like that you might consider select case statements, they are much faster typing than nested if statements

Code:
Select Case ucase(Text1.Text)
   Case "HELLO"
      Text2.Text = "Hallo"
   Case "NEXTWORD"
      Text2.Text = "Translation"
   Case .....
      ....

   Case Else
      MsgBox "Word was not found"
End Select


However this is a very crude way of translating something since you will have thousands of case statements there. You might consider using a ADO database with two fields where one holds the word the other holds the translation. Then all you have to do is search for the word your looking for in the database, and the database can easily be updated too.
 
Last edited:
Eagle said:

However this is a very crude way of translating something since you will have thousands of case statements there. You might consider using a ADO database with two fields where one holds the word the other holds the translation. Then all you have to do is search for the word your looking for in the database, and the database can easily be updated too.

very true, ado in VB is extreemly easy and just takes a lil time to get used to... databases can be created in access if your low on resoruces too ;)
 
OP
G

GuestX

New member
SculleatR said:
i don´t now how to use LCASE or UCASE but my Code currently:
(Like)


If txt1.Text = "Hello" Or txt1.Text = "hello" Then
txt2.Text = "Hallo"
ElseIf....
(Other Words)...
(and finally if the word was not found)
Else
MsgBox "Word was not found"
End If

Code:
If txt1.Text = "Hello" Or txt1.Text = "hello" Then
txt2.Text = "Hallo"
ElseIf....
(Other Words)...
(and finally if the word was not found)
Else
MsgBox "Word was not found"
End If

fixed, 1a :happy:
 

Eagle

aka Alshain
Moderator
Umm, there is a lot to cover there in the tool bar, any specific question?

As for the tabs, they are pretty easy to use. Just create one and set the number of tabs and set their labels and size and orientation, etc. Use the SSTab (Microsoft Tabbed Dialog Control) the one in the common controls suck. Each Tab has its own index in the Tab property, and each tab has its own caption. Thats really all there is to know about it.
 

Eagle

aka Alshain
Moderator
Well it all depends on what you want to do. If you want them to be permanent tabs, there is no code. Tabs are like containers, you place other objects in them, like a frame. If the tabs are permanent its all done in the properties dialog box. If you want the tabs to be dynamic so the names and number of tabs can be changed with code, its pretty self explanitory though. To change focus to a specific tab at runtime

where x is the tab index
Code:
SSTab1.Tab = x

after changing the tab you can set the caption just like any other object. The number of tabs can be changed at runtime too.
 

Doomulation

?????????????????????????
Lol, the toolbars are easy to implent.
Just add a reference to "microsoft windows common control 6.0 (sp4)" and you got a toolbar. Add it to the form and click customize in the properties window.
 

Eagle

aka Alshain
Moderator
Doomulation said:
Lol, the toolbars are easy to implent.
Just add a reference to "microsoft windows common control 6.0 (sp4)" and you got a toolbar. Add it to the form and click customize in the properties window.

Well, the properties are whats complicated, associating them with Image lists can be annoying at times and such, especially if you want to add an image after associating it.
 

Top