Click here to Skip to main content
15,889,887 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Order Help! Pin
Wes Aday13-Apr-14 14:18
professionalWes Aday13-Apr-14 14:18 
AnswerRe: Order Help! Pin
Peter Leow13-Apr-14 15:21
professionalPeter Leow13-Apr-14 15:21 
Question1 form, 2 text boxes, how to write code to exchange text between boxes Pin
ChaseG12-Apr-14 13:24
ChaseG12-Apr-14 13:24 
AnswerRe: 1 form, 2 text boxes, how to write code to exchange text between boxes Pin
Wes Aday12-Apr-14 13:43
professionalWes Aday12-Apr-14 13:43 
AnswerRe: 1 form, 2 text boxes, how to write code to exchange text between boxes Pin
Tim Carmichael12-Apr-14 13:44
Tim Carmichael12-Apr-14 13:44 
GeneralRe: 1 form, 2 text boxes, how to write code to exchange text between boxes Pin
ChaseG12-Apr-14 17:13
ChaseG12-Apr-14 17:13 
GeneralRe: 1 form, 2 text boxes, how to write code to exchange text between boxes Pin
Richard MacCutchan12-Apr-14 22:01
mveRichard MacCutchan12-Apr-14 22:01 
AnswerRe: 1 form, 2 text boxes, how to write code to exchange text between boxes Pin
Tino Fourie24-Apr-14 3:46
Tino Fourie24-Apr-14 3:46 
This might be a little late but still good for educational value.

All the suggestions are perfectly correct and easy to read when inspecting the code.

However there is one other way of doing this without declaring any additional variables like:
VB
Dim txtA as string 'Stores the text of TextBoxA
Dim txtB as string 'Stores the text of TextBoxB


Each control has a "Tag" property that you can use to store any type of text.
Therefore you can write the following code without declaring any additional variables.

In your "Form_Load"
VB
txtA.Tag = txtA.text 'Copy text to Tag
txtB.Tag = txtB.text 'Copy text to Tag


In the Button_Click event of the Swop Button you write:
VB
txtA.text = txtB.Tag 
txtB.text = txtB.Tag


The "Tag" property has many uses, this is but one possible use to keep from declaring too many variables for silly little tasks while you have other places to store relevant data.
Regard,
Tino
"Plan your work, Work your plan"

Questionhow to import all csv files in c: drive to database ? Pin
sensizbenlik12-Apr-14 11:45
sensizbenlik12-Apr-14 11:45 
AnswerRe: how to import all csv files in c: drive to database ? Pin
Wes Aday12-Apr-14 12:29
professionalWes Aday12-Apr-14 12:29 
AnswerRe: how to import all csv files in c: drive to database ? Pin
Mycroft Holmes12-Apr-14 14:43
professionalMycroft Holmes12-Apr-14 14:43 
Questionhow to import all csv files in a drive to database ? Pin
sensizbenlik11-Apr-14 12:10
sensizbenlik11-Apr-14 12:10 
AnswerRe: how to import all csv files in a drive to database ? Pin
PIEBALDconsult11-Apr-14 12:35
mvePIEBALDconsult11-Apr-14 12:35 
GeneralRe: how to import all csv files in a drive to database ? Pin
sensizbenlik11-Apr-14 13:17
sensizbenlik11-Apr-14 13:17 
GeneralRe: how to import all csv files in a drive to database ? Pin
Mycroft Holmes11-Apr-14 13:54
professionalMycroft Holmes11-Apr-14 13:54 
GeneralRe: how to import all csv files in a drive to database ? Pin
sensizbenlik12-Apr-14 8:00
sensizbenlik12-Apr-14 8:00 
GeneralRe: how to import all csv files in a drive to database ? Pin
Richard MacCutchan12-Apr-14 11:31
mveRichard MacCutchan12-Apr-14 11:31 
QuestionLogout button on a Main form Pin
waner michaud10-Apr-14 4:54
waner michaud10-Apr-14 4:54 
QuestionRe: Logout button on a Main form Pin
Eddy Vluggen10-Apr-14 6:45
professionalEddy Vluggen10-Apr-14 6:45 
AnswerRe: Logout button on a Main form Pin
waner michaud10-Apr-14 7:07
waner michaud10-Apr-14 7:07 
AnswerRe: Logout button on a Main form Pin
Eddy Vluggen10-Apr-14 7:38
professionalEddy Vluggen10-Apr-14 7:38 
GeneralRe: Logout button on a Main form Pin
waner michaud10-Apr-14 15:21
waner michaud10-Apr-14 15:21 
GeneralRe: Logout button on a Main form Pin
Eddy Vluggen11-Apr-14 0:38
professionalEddy Vluggen11-Apr-14 0:38 
QuestionValue of type 'String' cannot be converted to 'System.Windows.Forms.Control' Pin
Ankush Seth9-Apr-14 23:26
Ankush Seth9-Apr-14 23:26 
AnswerRe: Value of type 'String' cannot be converted to 'System.Windows.Forms.Control' Pin
Richard MacCutchan9-Apr-14 23:30
mveRichard MacCutchan9-Apr-14 23:30 

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.