Reply

Join Date: Aug 2009
Posts: 30
Reputation: drabsch is an unknown quantity at this point 
Solved Threads: 0
drabsch drabsch is offline Offline
Light Poster

=" =" "

 
0
  #1
25 Days Ago
I need to copy text form a text box

for example:

My text box has

temperature="18.5"

in it and i want to copy the text 18.5 i already have it selected i just need to copy it or put it into a var
Last edited by drabsch; 25 Days Ago at 5:48 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 471
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 24
abu taher's Avatar
abu taher abu taher is offline Offline
Posting Pro in Training
 
0
  #2
25 Days Ago
for copy
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Clipboard.Clear
  2. Clipboard.SetText text1.SelText
for paste in other textbox
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. text2.SelText = Clipboard.GetText()
I like sword. Attack or Defense.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 239
Reputation: AndreRet is an unknown quantity at this point 
Solved Threads: 33
AndreRet AndreRet is offline Offline
Posting Whiz in Training
 
0
  #3
25 Days Ago
First of all, var (variance takes up unneccesary space or memory. Declare your text as an integer. i.e.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim x as Integer
  2. x = Text1.Text

The next question is? - Where do you want to copy the the temperature Integer? Into a database or just for calculation. There is different options to what you want to do...
Please mark questions as answered when done.

Be the ONE!!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 30
Reputation: drabsch is an unknown quantity at this point 
Solved Threads: 0
drabsch drabsch is offline Offline
Light Poster
 
0
  #4
24 Days Ago
i found some info and i am using the code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Function find(first, second)
  2. pos = InStr(1, Text1.Text, first, vbTextCompare)
  3. pos2 = InStr(1, Text1.Text, second, vbTextCompare)
  4. start = pos + Len(first)
  5. length = pos2 - start
  6. Text1.SelStart = start
  7. Text1.SelLength = length - 2
  8. End Function

to find and select the text.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 239
Reputation: AndreRet is an unknown quantity at this point 
Solved Threads: 33
AndreRet AndreRet is offline Offline
Posting Whiz in Training
 
0
  #5
24 Days Ago
Now I understand. You wanted to search a text box when certain criteria is passed. You can also do the same with the following -

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2. Private Declare Function SendMessage Lib "User32" _
  3. Alias "SendMessageA" (byval _
  4. hWnd as Long, _
  5. byval wMsg as Integer, _
  6. byval wParam as string, _
  7. lParam as Any) as Long
  8.  
  9. Const LB_FINDSTRING = &H18F
  10.  
  11. Private Sub Form_Load()
  12.  
  13. With List1
  14. .Clear
  15. .AddItem "18.5" 'or whatever you would like to add, whether from a file or database...
  16. End With
  17.  
  18. End Sub
  19.  
  20. Private Sub Text1_Change()
  21. List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, _
  22. Text1, byval Text1.Text)
  23. End Sub

Note that 'Sendmessage' generates errors in Vista....
Please mark questions as answered when done.

Be the ONE!!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 30
Reputation: drabsch is an unknown quantity at this point 
Solved Threads: 0
drabsch drabsch is offline Offline
Light Poster
 
0
  #6
23 Days Ago
thanks
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC