Click here to Skip to main content
15,912,897 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: interface connected to db Pin
Dave Kreskowiak25-Sep-03 5:18
mveDave Kreskowiak25-Sep-03 5:18 
GeneralControl Authoring Question Pin
shayhay24-Sep-03 16:21
shayhay24-Sep-03 16:21 
Generala question about String Pin
smartnose24-Sep-03 15:52
smartnose24-Sep-03 15:52 
GeneralProblem when opening excel in VB6 Pin
Jacques Bérard24-Sep-03 13:58
sussJacques Bérard24-Sep-03 13:58 
GeneralBad Sector Pin
visualhyd24-Sep-03 4:19
visualhyd24-Sep-03 4:19 
GeneralRe: Bad Sector Pin
Dave Kreskowiak24-Sep-03 4:48
mveDave Kreskowiak24-Sep-03 4:48 
Generaloperator overloding in VB Pin
Populate12324-Sep-03 2:15
Populate12324-Sep-03 2:15 
GeneralRe: operator overloding in VB Pin
Dave Kreskowiak24-Sep-03 4:46
mveDave Kreskowiak24-Sep-03 4:46 
First, VB6 doesn't do true OOP and does not support operator overloading at all.

Second, the code you wrote is making an incorrect assumption about the VarType function. VarType will return the Type of the Variable, not its contents.
Private Sub cmdDo_Click()
   Dim ty
   If ((VarType(Me.txtInput.Text) = vbString) And (VarType(Me.txtOutput.Text) = vbString)) Then
   ty = Me.txtInput.Text & "--" & Me.txtOutput.Text
   MsgBox ty
   ElseIf ((VarType(Me.txtInput.Text) = vbInteger) And ((VarType(Me.txtOutput.Text) = vbInteger))) Then
   ty = (Me.txtInput.Text) + Me.txtOutput.Text
   MsgBox ty
Else
   MsgBox "Unknow Format or mismatch data"
End If
End Sub
The VarType statements of all your Text properties will ALWAYS return vbString. If you hit F2, select the TextBox control in the left pane and then the Text property in the right pane, and look at property details at the bottom of the window, you'll see that it says
Property Text As String
    Member of VB.TextBox
    Returns/sets the text contained in the control.

On top of that, both the '&' and '+' operators, when used with strings (.Text properties) will always append one string to another. In your code, you essentially did the same thing twice. Both 'ty=' statements will append one string to another.

RageInTheMachine9532
GeneralRe: operator overloding in VB Pin
Link260024-Sep-03 12:26
Link260024-Sep-03 12:26 
GeneralRe: operator overloding in VB Pin
Dave Kreskowiak24-Sep-03 15:40
mveDave Kreskowiak24-Sep-03 15:40 
GeneralRe: operator overloding in VB Pin
Nick Seng24-Sep-03 17:09
Nick Seng24-Sep-03 17:09 
GeneralRe: operator overloding in VB Pin
Dave Kreskowiak24-Sep-03 17:38
mveDave Kreskowiak24-Sep-03 17:38 
GeneralRe: operator overloding in VB Pin
Anthony_Yio3-Oct-03 21:29
Anthony_Yio3-Oct-03 21:29 
GeneralRe: operator overloding in VB Pin
Anonymous24-Oct-03 8:54
Anonymous24-Oct-03 8:54 
GeneralAudit log Pin
24-Sep-03 1:32
suss24-Sep-03 1:32 
GeneralControl Designer & Child Controls Issue Pin
scott@otech.com23-Sep-03 4:15
scott@otech.com23-Sep-03 4:15 
GeneralProblem with Web Client Pin
КфВ22-Sep-03 21:05
sussКфВ22-Sep-03 21:05 
GeneralRe: Problem with Web Client Pin
Jim Taylor25-Sep-03 4:19
Jim Taylor25-Sep-03 4:19 
GeneralHelp Pin
Anonymous22-Sep-03 6:58
Anonymous22-Sep-03 6:58 
GeneralRe: Help Pin
NetPointerIN22-Sep-03 11:14
NetPointerIN22-Sep-03 11:14 
GeneralRestoring of DB Pin
Anonymous22-Sep-03 3:27
Anonymous22-Sep-03 3:27 
GeneralAccess Report Printing from VB Pin
Dangleberry21-Sep-03 22:26
sussDangleberry21-Sep-03 22:26 
QuestionIs it possible??? Pin
Doominator21-Sep-03 12:04
Doominator21-Sep-03 12:04 
GeneralPrinting Software - Please Help Me .... Pin
Wism Chan20-Sep-03 14:28
sussWism Chan20-Sep-03 14:28 
GeneralCalendar & DropDown boxes for changing Calendar Month, Day, Year Pin
iamalexCode20-Sep-03 11:24
iamalexCode20-Sep-03 11:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.