Problem Moving Between Text Boxes
Hi all,
I have a Form with two text boxes. All the controls have the VB assigned default names. Basically I want the user to enter the data before he leaves the text box to the next one, by pressing tab or using the mouse. So I tried using the following code .. Code: Private Sub Text1_LostFocus() If (Text1.Text = "") Then MsgBox ("TextBox 1 is empty please reenter ") End If Text1.SetFocus End Sub
Private Sub Text2_LostFocus() If (Text2.Text = "") Then MsgBox ("TextBox 2 is empty please reenter ") End If Text2.SetFocus End Sub
The problem is that if I move from Textbox1 to Textbox2 by pressing Tab, I get the Msgbox saying "Text Box1 is Emtpy" , but when I click Ok, the control returns back to Text1, but in the process it triggers the lost focus event of Text2 so I get the message "Text box 2 empty" and this messages cycle on for ever, and I end up killing my application. Can anyone suggest a way to avoid this problem ?
Thank You
Senthil
Edited by - IDontKnow on 8/10/2004 9:31:36 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving Text Boxes
Hiii,
I need to move a text box to the mouse point. How can I move. How can I get the mouse location.
Thanks
Sam
Searching Text For Strings And Moving It To Text Boxes
Hey all,
Got a quick question about the best way to search text.
I currently search a textbox (txtdata.text) for a set of about 30 words (Ex:server1) as shown below:
Server1 88,324
Server2 65,343
Server3 54,789
Server4 99,324
~
Server30 12,234
The 1st value "server" is placed in a text box called V#.text and the associated amount is copied to a 2nd text box called R#.text.
In order to separate the 2 values I use this code:
Search21 = v21.Text
Where = InStr(txtData.Text, Search21)
If Where Then
'txtData.SetFocus
txtData.SelStart = Where - 1 + 8
txtData.SelLength = Len(Search21)
r21.Text = txtData.SelText
End If
I need this to be repeated 30 times over to get all 30 values in their boxes.
This is a huge pain & probably the worst way to do it but it works.
Anyone have a better idea on how to do this?
Thanks
Problem Moving Between Text Boxes
Hi all,
I have a Form with two text boxes. All the controls have the VB assigned default names. Basically I want the user to enter the data before he leaves the text box to the next one, by pressing tab or using the mouse. So I tried using the following code ..
Private Sub Text1_LostFocus()
If (Text1.Text = "") Then
MsgBox ("TextBox 1 is empty please reenter ")
End If
Text1.SetFocus
End Sub
Private Sub Text2_LostFocus()
If (Text2.Text = "") Then
MsgBox ("TextBox 2 is empty please reenter ")
End If
Text2.SetFocus
End Sub
The problem is that if I move from Textbox1 to Textbox2 by pressing Tab, I get the Msgbox saying "Text Box1 is Emtpy" , but when I click Ok, the control returns back to Text1, but in the process it triggers the lost focus event of Text2 so I get the message "Text box 2 empty" and this messages cycle on for ever, and I end up killing my application. Can anyone suggest a way to avoid this problem ?
Thank You
Senthil
Moving Dialog Boxes
Hi,
Is there any method to set the locations of the Dialog boxex ?
We can give the location of the "Windows", "Forms" by using Move or MoveWindow(API) methods. Like that can we locate the "Dialog" boxs...?
I think this can do bcos Microsoft applications has this kind of Dialog boxes and they are showing in correct locations of the screen
How can i do this...? Pls help me find out
Moving Picture Boxes
I am making a soccer shoot-out game and i want to move the soccerball (the Picture Box) to where the player selects eg. top right, top left, top centre, bottom right, bottom left, bottom centre. If someone could please help me with this code it would be much appreciated
Moving Boxes With Loops
Private Sub cmdleft_Click()
Loop
frmloop.Left = frmloop - 1
Do Until frmloop.Left = 2
End Sub
Private Sub cmdright_Click()
frmloop.Left = frmloop + 1
End Sub
Private Sub cmdup_Click()
frmloop.Top = frmloop - 1
End Sub
Private Sub Cmddown_Click()
frmloop.Top = frmloop - 1
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
It keeps saying I have a loop without a do in the first cmd. THE DO is there. Why doesn't it like me.
Moving Picture Boxes
Does anybody know how to move a picture boxe across the screen within a visual basic form.
Moving Multiple Picture Boxes - Lag?
On my form I have a control array of 239 picture boxes NOT being moved. Then I create 5 picture boxes of a new control array and move them with a timer with the interval set to 10. It moves fine, but when I load another 5 picture boxes totaling 10 the game starts to lag by the images starting to move slower then set to. The more I load and more the slower it keeps getting.
I am increasing the .top of all of the picture boxes by 25 every time the timer ticks with a 10 interval.
How can I prevent this 'lag'?
Moving Item Between List Boxes
I have a command button with the Caption ">". When clicked I want the selection the user has made in ListBox1 to be moved to ListBox2.
Anyone ever do something like this before?
thx..
Moving Picture Boxes W/ Keyboard
is there a way to be able to move picture boxes using the keyboad? i.e picturebox1 moves up using the caps lock key, and down by using the shift key. picturbox2 moves up using the plus sign(the one all the way to the right of the keyboard no the one above the equal sign) and moves down by hitting the enter key(under the plus sign).thnx in advance for any help.
Moving Data Between List Boxes
Hi,
I need a little help if anyone has a moment. I have 2 list boxes one called lstSource and the other is lstDestination. I have it set up and working so that I can multi select rows in my source and move them into my value list in my destination list box. I call the function in the click even of a right arrow button. This works great.
Now I want the user to be able to remove fields from the lstDestination in case they make a mistake or change their mind. I want to do this using a left arrow button but I can't quite get the code working properly. I have gotten it to do everything butx but....however, I can't get it to just delete the selected row(s). Here is my code that is working to move my rows from my lstSource to my lstDestination. I assume it must be some variation of this....
<vb code>
Private Sub cmdCopyItem_Click()
CopySelected Me
End Sub
Function CopySelected(frm As Form) As Integer
Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer
Set ctlSource = frm!lstSource
Set ctlDest = frm!lstDestination
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(0, _
intCurrentRow) & ";"
End If
Next intCurrentRow
' Reset destination control's RowSource property.
ctlDest.RowSource = ""
ctlDest.RowSource = strItems
End Function
</vb code>
Moving Arround A Control Array Of Txt Boxes
hi could any body tell me how i can use the arrow keys to move between txtboxes in a control array i have 41 txtboxes in the form of 7 columns by 6 rows.
the code i came up with as an idea was:
Code:
Dim iLoc As Integer
txtPuz(Index) = iLoc
If KeyCode = vbKeyUp Then
If iLoc > 6 Then
iLoc = iLoc - 7
txtPuz(iLoc).SetFocus
End If
End If
If KeyCode = vbKeyDown Then
If iLoc < 35 Then
iLoc = iLoc + 7
txtPuz(iLoc).SetFocus
End If
End If
It didnt work properly when set to the forms keydown event. so what code would be best and where would i put the code?
Thanks
Want To Convert Text In Text Boxes To Normal (without Text Boxes)
Hi all,
Our Client is sending files in RTF Document format which has some content. Each and every word in that document is in its own text boxes (i.e., the RTF has full of text; each and every word is in own text box). I need to convert it to normal word document without text boxes. But my problem is the entire content of that file is coming in text boxes. so it is very difficult to convert it to normal word document (without text boxes).
Currently I have two choices to do that: one is select the text box and copy the content and paste it in a new file. but all formatting is lost. i have to do all formatting manually. The second option is convert it to PDF and do a conversion and check alignments give some missing formatting etc.
These cases are ok if I got a file with full of text paragraphs. but most of the time I am getting tables. That time these ways are not smart way to do that.
Is there any other way to convert that file to normal word document. Pls let me know.
Currently I used to convert that document to Adobe PDF and will do a PDF conversion and then I will do a formatting as per the RTF document.
So, it is taking to much of time consuming and effort.
Is there any solution for this?
Thanks!
CS.
Moving Already Created And Configured Controls Into Frames/picture Boxes
I'm sure there is a simple way of doing this or a quick fix, but I'm currently struggling. I've made and coded for some controls (pictureboxes that move accross the screen).
However, I now want them to only be visible inside a picture box I have just created. But when run the image just moves behind it. I'm using sprites and the BitBLT method to draw and move my object.
Any suggestions appreciated.
Thanks
Can You Have Multiple Colours In Text Boxes, Or Richtext Boxes(etc)?
Is there anyway you can have each word in a text box a different colour? Like:
[RED] My Name [/RED]
[BLUE] What's up! [/BLUE]
or something similar?
I don't care if you can't do it in a text box but is there anyway to do it in any type of "text box"?
If sub classing is involved could you please point me to a tutorial?
Thanks a lot.
Web Control, List Boxes, Text Boxes, Please Help This Is Winding Me Up!
Hi guys i need some help with the webcontrol function in VB6
Part of my program needs to put listbox data from the program into a text box on the web and then click a submit button...
The list box i have has a list of multiple directories in (for the location of my files), from there i just want the program to put the top directory of the list box into a text box on the web and click a submit button on the web (its for uploading a queue of files), then after that has finished uploading, do the next directory in the list box... etc
It sounds pretty simple but i have no idea how to do it...
Thanks for any help you can give me, i will write a really good review about you and good rating etc.
Any knowledge of this would be greatly appreciated
thanks a bunch
toodle pipples
Alex
Combo And List Boxes To Text Boxes?
Connecting sub-menus to rich text boxes is fine is most cases but the user does not always want to use menus to load and display text. Applying the same technique as sub menus to text boxes with combo or list boxes just wont work could someone please help me out with this one.
Both combo and list boxes will for example:
Contain an alphabetic list.
When the user clicks on a file it should locate the text file from the drive.
It should then open it into a rich text box on the same form.
Could this be possible?
Please any help will greatly be appreciated.
Error Message With Opening Of A Text File And Inputing The Text Into Text Boxes
Hey all:
Here is the problem at hand. I have a procedure that opens a recently saved file and when executed places the contents of that file in the designated text boxes I have coded. But the thing is I am getting this error message during the process...
Quote: (Subscript Out of Range)
What does this mean?
Here is the code that I have so far... any help would be greatly appreciated.
Code: Private Sub mnuOpen_Click()
'Open a Previously saved file. Search values are suffixed with .txt
Dim r_strFileName As String
CommonDialog1.CancelError = True 'Set CancelError is true
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlOFNHideReadOnly 'Hide Read Only Files
CommonDialog1.Filter = "*.txt" 'Set Filters
CommonDialog1.DialogTitle = "Opening Saved Search - Locate Text File"
CommonDialog1.ShowOpen 'Display the Open dialog box
r_strFileName = CommonDialog1.FileName
'Existence Test
If Dir(r_strFileName) = "" Then
MsgBox r_strFileName & "File Does Not Exist!", vbCritical
End If
'Read File
On Error GoTo Tag800_error
Dim intFreeFile: intFreeFile = FreeFile()
Open r_strFileName For Binary As intFreeFile
Dim strData As String: strData = Space$(LOF(intFreeFile))
Get intFreeFile, , strData
'Remove Ending vbCrLf
strData = Left$(strData, Len(strData) - 2)
'Format Data
Dim strText() As String: strText() = Split(strData, vbTab)
lblAI.Caption = strText(2)
txtDataString.Text = strText(3)
Linear.Text = strText(4)
'Exit
GoTo Tag900_Exit
'Error Trapping
Tag800_error:
MsgBox "File Read Error" & r_strFileName & vbCrLf & "(" + Err.Description + ")", vbCritical
Err.Clear
'Housecleaning
Tag900_Exit: ' Housecleaning
On Error GoTo 0
Close intFreeFile
ErrHandler:
Exit Sub
End Sub
James
Check Boxes And Text Boxes
Using Excel 2000...
I have two questions; one, is it possible to "lock" a text box so that a user cannot enter/change data. I have a text box that is populated within the VB code, but I don't want the user to be able to click in the text box (BTW the textbox is in a userform) and change the entry.
Second question. Is it possible to "lock" a check box once a user selects it. So the user can select a checkbox, but once it is selected, he/she cannot uncheck the box.
Any advice or quidance would be appreciated. TIA
Help With Combo Boxes And Text Boxes
Hello, I am making a little test program and I want it so I can click on a item in my combo box and that word appears in my text box... any ideas? help please.
List Boxes And Text Boxes
Ok i have a list box that has a list of movies to choose from then you choose how many tickets you want i want to know how to display them in a text box and how to clear the dat file that i saved it in
Text Boxes And Combo Boxes
I am trying to create a system that will allow you to pick a name from a combo box and then other information about the person will appear in labels when a command button is clicked. The problem is, is that i do not know how to get the databar to link the correct information with the labels and with the right name.
Any Help??
List Boxes And Text Boxes
I have a list box with a bunch of items in it. I'm trying to make it so that when you click on an item in a list, the text appears in a text box. I don't know too much.. but what I have so far is
Private Sub List1_Click()
Dim i As Integer
Text1.Text = List1.List(i)
End Sub
What this does is when I click an item, it makes the text of the textbox the first item in the list. How do I change it so that I can pick an item from the list and have the text of that item displayed in the text box? Thanks in advance!
Check Boxes And Text Boxes
Is there any way to use a checkbox in a rich text box. Or another way to do what I need which is....
when someone double clicks on a url (not hyperlink) in my textbox, through an SQL statement if finds the matching url in my database and displays the article that matches that url? This was easy using a listbox, but I don't know how to specify the text in a text box that was double clicked. I hope this makes sense, if not I will try to clarify.
Thanks,
Cady
I was wondering about the check box cuz then I could match the url beside the checkbox, maybe?
List Boxes = Text Boxes
Hi I'm new here (and to VB). I'm using VB in Excel and trying to get a list box to write to a series of three text boxes. I have a mobile phone user form and the list box has a selection of phones in it. I want the user to be able to choose three phones from the same list box and have the results display - one in each box. Can I do this and, if so, how?
Add Text To Text Boxes Like List Boxes
ill explain this the best i can i want the user to type in some text then click "Add" and the text will be added to a textbox i know you can do this alot easyier with list boxes with the .AddItem but how would i do it so far if got this
VB Code:
Text1.Text = "" & Text2.Text
But as you notice it just overwrites the text allready in the box and doesnt ass it
Putting The Text Of Two Text Boxes Into One Multiline Text Box
Well I Got a Text1.Text and a Text2.Text
What I Am trying to accomplish is the following:
When I Press Command1, Text1 and Text2 both get put in one line on Text3.
Code:
Text3.Text = Text1.Text + " - " + Text2.Text
That does the Job, And thats where I Am so far.
However, I Need it so that if I Press Command1 Twice, then it goes to a new line
Meaning if Text1 and text2 both say ''test''
Text3 will be
Quote:
Test - Test
I Need it so when I press Command1 again it puts it in Text3 in a new line, and to keep the past one
So in the end it will be
Quote:
Test - Test
Test - Test
Test - Test
Etc depending on how many times I Click it.
Thanks
Save Text From Two Text Boxes Into 1 Text File?
I have two text boxes. Is it possible to save Text1 and Text2 into the same file, so that the new text file containing both Text1 and Text2's text will be like:
This is the text from Text1's text box
And this is Text2's text
Making a new line to seperate them, if you know what i mean?
Newbie-Opening And Saving Text Files In Text Boxes
I'm trying to find a way to save text from a text box as a .txt file or .rtf and then be able to retrieve files of similar type and open them in a text box on my program. There must be a way to do this, I'm just not able to figure it out. Help?
Fill Text Boxes With Text Search Results (Resolved)
Hello
I have a form with a ADODC control to my database. I have several text boxes on my form to enter new records. I would like to search my database thru a text box (Account Number) then populate the text boxes with the data results insstead of going next thru all the records
Example:
textSearch = (Account Number) 00001
Then if it is there populate the textboxes
txtAcct.text = 00001
txtName = John Doe
txtAdd = 123 main st
textCity = Anytown
txtState = MD
If not then msgbox "Record not found"
As always thanks for taking the time to read this'
Bob
Edited by - Bob Taylor on 7/29/2003 3:40:54 PM
Load Contents Of Text File To Text Boxes
Any Ideas on this? :
on an OnClick() event I need to load the contents of a text file:
string1, string2, string3, string4
into 4 text boxs:
text1
text2
text3
text4
Without creating an array...
Thank You,
dan-
Importing/exporting Text From Txt File Into Text Boxes
hi guys! i have two text boxes and one command button named Text1 , Text2 & Command1 respectively. i want that when i press command1 after putting some text into Text2, it saves text present in Text2 into a .txt file and then import it automatically into Text1 from that .txt file. i actually want it to make a chat room for my LAN. please note it that both text boxes have multi line property enabled. waiting for your help.. thanks in advance!
Downloading Multiple Text Strings Into Different Text Boxes.
Hi,
How do I download text strings that are on different lines from a .txt file online? For example, say I own the txt file http://members.tripod.com/member23/Textfile.txt ..... and within the txt file is the following lines:
hello
goodbye
welcome
go away
I can download the strings, but how do I put each line into a separate text box on my vb program?
Thanks in advance
Moving From One Text Box To Another
Hello everyone,
can anyone help me with this one? I want to move from one text box to another on pressing enter...
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
?
End If
End Sub
Moving Text
i m working on mp3 player n i wish to move the name of the song (only name and not location) scrolling, just as in winamp. can neone help?? please!!
Text Moving
Pls Help
have one file say text.txt in D drive and 40 Records i want to move orscroll all of them.
Problem if i use small font for the txt box txtScroll then it take morerecord and if i use biger font like 48 then it take only 6 or 7 recordand then start again from
1.
I want that with any size of font it should read till then end and startagain scrolling.
2.
then Text box i want to make Transparent like lable but in property ican find for text.
Can u pls help me
Regards
Moqeet
I am using following code
In module Code is this
Public Const EM_GETLINECOUNT = &HBA
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long ' <---
In Form
Private Sub cmdCredits_Click()
'Variable Declarations
Dim iFileNum As Integer
Dim lLineCount As Long
Dim lLineHeight As Long
On Error GoTo ErrHandler 'Goto to ErrHandler if an error occurs
If cmdCredits.Caption = "Hide Credits" Then
picScroll.Visible = False
tmrScroll.Enabled = False
cmdCredits.Caption = "&Roll "
Else
iFileNum = FreeFile
'open file and read text from it
Open "D: est.txt" For Input As iFileNum
txtScroll = Input(LOF(iFileNum), iFileNum)
Close #iFileNum 'close file
lLineCount = SendMessage(txtScroll.hwnd, EM_GETLINECOUNT, 0&,0&)
lLineHeight = TextHeight("TEST") 'Get the height of text infile
txtScroll.Height = lLineHeight * lLineCount
picScroll.Left = 0
picScroll.Visible = True
tmrScroll.Enabled = True
cmdCredits.Caption = "Hide "
End If
Exit Sub
ErrHandler:
txtScroll.Text = "File Not Found !!!" & vbNewLine & "TheCredits.txt file is missing"
Resume Next
End Sub
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Form_Load()
End Sub
Private Sub tmrScroll_Timer()
'scroll txtScroll
If txtScroll.Top + txtScroll.Height < picScroll.Top Then'picScroll.Top
txtScroll.Top = picScroll.Height
Else
txtScroll.Top = txtScroll.Top - 15
End If
End Sub
Private Sub txtScroll_GotFocus()
cmdOK.SetFocus
End Sub
Mirroring VB Text In ASP Page Text Boxes
I have a VB app that collects data from a database and displays the data in textboxes on a form. This app, as well as the databases it queries, runs on remote machines located around the country. Also visible on the VB form is a browser control displaying an ASP page, with textboxes matching the ones on the VB app. The ASP page, as well as the database it will update, runs here on our local servers. I want the contents of the asp text boxes on the VB form to echo the contents of the VB textboxes! Said another way, the values of the VB txtBoxes (remote) must feed into the ASP page txtBoxes (local) for subsequent dumping into our data server (local). NO WHERE can I find code that will enable this process. Keep in mind: there is NO human interaction with this application, rather it is all fired by automated processes on the remote machines! Everything is working fine except for the transfer of data FROM VB TO ASP. Any suggestions? Thank you, and Happy New Year!
Select Text When Entering Text Boxes
Is there a property to select the text when you enter a text box or do I have to do something like this :
Private Sub txtModele_GotFocus()
txtModele.SelStart = 0
txtModele.SelLength = Len(txtModele.Text)
End Sub
Printing Text From Individual Text Boxes
Hi all
I am trying to print text from individual text boxes on a form using Visual Basic V6.0. The form has 18 individual text boxes on it, each text box displays a letter and number.
I would like to be able to print the text from the first 5 text boxes in one line when there is text in them, and the last 13 text boxes in one line when there is text in them, so when the user clicks the "print command button" the program prints the text in each text box.
Could someone help me with this problem, by maybe writing a couple of code to get me started? I have attached an image of the form for you to view so you can get a better idea of what I want to do.
Thank you
Loading Text File Into Various Text Boxes
Hope someone can help. I've been trying to get a text file and look like..
input=c: estinput
output=c: estoutput
i've been trying to read the first line and find the "=" then anything after this use in text1.text
Anyone have any ideas? I'm newish and at the moment my head just wont work..
Thanks
Text Files To Display In Text Boxes
I have a text file, how do I display the ENTIRE text file into a text box? does the text box have the properties to allow for word wrapping and having a scroll bar as needed? Thanks
Problem W/ Text File And Text Boxes
I've tried a few different approaches to this problem, and I'm sure that you guys are gonna present me w/ an east solution but here goes. I'm trying to read an entire text file into a text box but no matter how I do it I can only get it to read the very last line into the text box. (yes, multi-line is true) I can't figure out what's the problem with my code. I would post it but I don't have it on this system. Anyway. Thanks in advance.
I Need Help With Find Text/ Print With Text Boxes
i am currently working on a project and i can't get the code for how to acctually send the data to the printer. I also would like some help in finding text by "searching" for it. if you can help me please do.
thanks,
kirk
How To Force Text Selection For All Text Boxes
In MS Access, there is a "Behavior entering field" setting under Options, Keyboard, that allows you to specify a default behavior when a field is entered; you can choose "Select entire field", "Go to start of field" or "Go to end of field", and that choice will be applied to all controls on all forms and datasheets.
I'm looking for a corresponding setting for a compiled VB 6 application, but have been unable to find it. Specifically, I want the entire existing text to be selected whenever a textbox receives the focus, anywhere in the application.
I know that I could accomplish this by manually setting each textbox's .SelStart and .SelLength properties, but to do that for each textbox in the application is a pretty brittle (not to mention time-consuming) solution. There must be a better way...
Reseting Text Boxes To Their Original Text
It seems that whenever I hide my form, then show my form the changes i have made to various text boxes remains.
I'd like the text boxes to return to their original text whenever i hide the form.
Code:
form3.text1.item.text="Default"
That doesn't work. It doesnt work by taking the form3 and the item out either.
Any help?
|