Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Easy One...disallow User To Enter A Space In Textbox


In my program, when the user enters something in the textbox, they cannot enter any spaces. I want to be able to detect if the user has entered a space and if so, just cancel that key press.

Also, on the keypress event, I change any letters that the user puts in to capitals. It seems if the Keypress event fires, the key down event does not fire.

User enters: Ab C

I would want it to be: ABC

I was hoping not to alter the string on the validate or lost focus event, but to do it right when the user presses the key or spacebar.


Any suggestions,

Thanks,
M




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Disallow User To Enter Into Datacombo
Does anyone know how to disallow user from entering into a datacombo which allows only user to select from the combo list.

Best Regards,
Roy

How To Disallow User To Enter Text In Combo Box?
where user can only choose the predefined selection??

Lock Textbox So The User Only Can Enter Numbers
Hi.

I want to lock the textbox so you only can enter numbers in it and not letters. Well I can have it two ways...one is that it is not possible at all for the user to enter letters OR I can add a click-event so a msgbox pops up and tells the user someting like: You can only enter numbers.

How do I do this? Both methods is OK.

How To Stop Execution Of Procedure, And Wiat For User To Enter Value In Textbox?
Helloooo!!!


In my application, at runtime i am loading form from Module. I want to stop execution my procedure in modelu, until user enter value in Textbox of opendform and close that form.

I am trying to use WaitForSingleObject DLL to do this. But somehow i am not getting my procedure to stop unitll user entered value in textbox.

Is it possible to do this with "WaitForSingleObject"? If yes, then do i need to create object of Form?

I am using Load Mehtod to load form runtime.

Help, Anybody? I am stuck.

HDave

How To Delete Or Clear Textbox Last Character When User Enter The Wrong Format..??
How to Delete or Clear Textbox last character when user enter the wrong format..??

I have try a code the function is when detect there is wrong format it will count the textbox length and set the length minus 1... but the setfocus run to the first character place... any idea if this to avoid the setfocus run to infront and remain at the last character?

Disallow The User From Editing The Registry Using VBcode
Hey.

Is there any way I can disallow the user in the current session from editing the registry, not using Group Policies, but using VB?

In case I do not wish to disallow him running programs in general, and restricting the programs to only those that are allowed by me, but just disallow him touching the registry the current session?

Thanks

Disallow Refreshing In Textbox?
I am using this code:

Private Sub Form_Load()
A = " --STRING-- "
End Sub

Private Sub Timer1_Timer()
Text1.Text = Left(A, i) & " _"
i = i + 1
End Sub


What this does is it prints A (String) by simulating typing.... However, when doing this, I found that I could not reduce the flicker... Also, I cannot scroll down the textbox if the string is longer than what fits in the textbox.... So does anyone know how to stop the flicker and to be able to scroll down while the program is simulating typing? If you have a better method for doing this simulation, ie. SendmessageA, go right ahead and post a reply! Thanks in advance.

Enter The Current Time In A Field Using The Space Bar.
Is there a way, using VB code, to enter the current time in a field using the space bar. The field name is "received".

Thanks


Resolution:

If keyascii = 32 Then
Received = Time
keyascii = 0


End If

End Sub

Thanks "trinic"

Out Of Stack Space? Easy, Straight Forward Sub
The following code is very simple and straight forward, and I have used it many times, but now it's producing an "out of stack space" error that I perried with the On Error Resume Next statement. It fixed my problem til I compiled it and went to show my boss how cool this is, then the beeotch crashed! * * *.... This isn't rocket science, it's a checkbox! Anyone see anything stupid 'cause I have those tendancies, but I figured it should work.


Code:
Private Sub Check1_Click()
On Error Resume Next
If Check1.Value = 1 Then
Check1.Value = 0
Text1(1).Text = "1001 E. Washington Ave."
Text1(2).Text = "Santa Ana"
Text1(3).Text = "Ca"
Text1(4).Text = "92701"
Exit Sub
End If
On Error Resume Next
If Check1.Value = 0 Then
Check1.Value = 1
Text1(1).Text = ""
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
Exit Sub
End If
End Sub

PS... I just noticed this is backwards. If you check the box, the address should show up, if you uncheck it, it should disappear. But... if I check it nothing happens til I uncheck it, then the address pops up. I don't know.

In Vb.net From 1 Textbox To Another Textbox Moving By Pressing Enter
as in vb6.0 we r write code in textbox keypress event as follow to move from textbox1 to textbox2.

if keyascii = 13 then
    textbox2.setfocus
endif

so above same task i want to do in VB.net
Please help me to solve it

Thank you

EASY: How To Pad A String With Multiple Space Chars Up To A Certain Length
I basically want to tag some listbox entries with additional text which will follow the listbox entries as they move around due to sorting which occurs on the listbox. My goal is to append the required "extra non-viewable" data to the end of each listbox entry but I must append it after a bunch of spaces so the user will not see this "extra" data in the listbox.

Example:
I have a string equal to "ABCDEFGH" (ie: length of 8) and want to format it to be the following:

    "ABCDEFGH"<182 space characters>"NOW I CAN ADD MORE DATA"

I was thinking I could use the Format command but can not figure out how to do this.



Edited by - uncletr on 7/1/2004 12:19:05 PM

EASY: How Can I Init An Array Based On A Space Delimited String
I have a string "ABC DE F HIJ" and I want to populate an array as follows:

myArray(0) = "ABC"
myArray(1) = "DE"
myArray(2) = "F"
myArray(3) = "HIJ"



I know I read how to do this somewhere, but for the life I me I can not locate the example anymore. Iremember it was just a one liner ......

Thanks again!



Edited by - uncletr on 6/16/2004 1:56:24 PM

Pressing Enter To Go From Textbox To Another Textbox.
I have this code but it is not working, is there a form or text box property that needs to be set? Thanks...

Code:
Private Sub TextCustomerName_KeyPress(KeyAscii As Integer)

If vbKeyReturn = KeyAscii Then
r = Set_Focus(TextProduct)
End If

End Sub

What's The Best Way To Have The User Enter A Time?
I've never really worked with values of time in VB before. I now have a program where the user needs to enter a value in hours and minutes.

It's too keep track of how late someone shows up for work so I think I'd like the user to enter something like 1:22 for one hour and twenty two minutes.

What controls, formats are best suited for using time ?

When The User Hits Enter Do This....
I have a form and I want to set it up so that the user doesn't have to use the mouse to click on the "Submit" button.

How do I set it up so that if a particular textbox has focus and the user hits enter, it automatically hit's the "Submit" button?

Space In The TextBox
Can someone tell me How autmatically put a space in the TextBox. For example, you have a Text Box (txtName) that allows the user to enter their name. The users will enter their First Name followed by a space then their Last Name.You want to display in a label control (lblName) their Last Name followed by a comma, followed by a space, then their First Name.

Textbox Space
I have textbox. How to pop up messagebox if the textbox contains empty space between text?for example "A A" or "A A A A A"

Determine Free Space On A User-Specified Drive?
Me again.
Now that the managers in my group know I'm using VB6 for this project, they're loading me up with requests / changes to the way we used to do things. Problem is that I'm a total n00b, so I spend most of my time researching and learning.

Anywho, enough rambling and down to the question.

I have a form that I want the users to be able to put in a Drive letter into a TextBox and click a button to find out how much free space they have on that drive. I don't want them to worry about having to put in the ":", I want them to just put in the "C" (without quotes) and have the amount of free space show up on the form (or on a message box, I haven't decided yet). I also don't want to use the Text1_Change, as I want them to execute this by hitting the button.

Right now my best attempt is


Code:
Dim text1 As String

Dir = (text1)


but I know this isn't right (as I'm getting an error message LOL). I know that doing the Dir command in the Command Prompt gives me the information I need as the last line, but I'm stumped as to how to pull that information into VB.

(As an aside question, would calculating the number of gigabytes just be (((code determining free space)/1024)/1024)??? )

Thanks, any and all help appreciated as always....
Chris

How To Make It So That User Must Enter Only Number
so yea how do i make it so that a user can only input numbers into an input box otherwise a msg will be displayed saying that user must enter only a number value

How Trim The Data Enter By User
Hi guys,

i has create an interface just like below and this interface has a connection with a database. Can someone tell me how to Trim the data that is enter by the user in this interface and then show the data between the "From date" to "To date ". if you guys has an example like this please share it with me. Thanks

What File Name Did User Enter In Dialog Box?
I have this coding:

strSaveToPath = Application.GetSaveAsFilename("C:A.txt", fileFilter:="Text Files (*.txt), *.txt")

This brings up a dialog box with C:A.txt as default file in the File Name box.

Later I use this code to run a slideshow:

Shell "D:/Program FilesIrfanviewi_view32.exe /slideshow=C:a.txt", vbNormalFocus

All is well if user accepted C:a.txt default. But how can i tell what file user selected if other than default so I can change it in the shell code?

How To Save Settings Enter By User??
i am doing a program that lets the user select the volume and other setting like zoom, focuz, mute..... by using sliders and option button. in the same form, i have a command button that is to save the new setting input by the user. is there anyway to write the code so that the next time the user runs my program again, the setting will remain the same? and when the user change some of the setting n click save command button, the new value of the setting will be saved.
thanx!

How Do I Find Out If User Hits The Enter Key???
HOW DO I FIND OUT WHETHER USER HITS THE ENTER KEY???
GETKEY?........
KEYPRESS?......

THANKS FOR THE HELP

Allowing The User To Press The Enter Key
Hello,

In case Curlywink's suggestion doesn't work for you, you can try adding the following code in the textbox's keypress event:

Code:
If KeyAscii = vbKeyReturn then
KeyAscii = 0 'Eliminates Beep
Call cmdEnter_Click
End if


Hope this helps.

JMik

Need To Let User Enter A List Of Items
To make a long story short, how can let my user enter a list. This list will be inserted into a database with a SQL statement.

I would like the look and fuctionality of the DBGrid control, but I can't bind it to a database. I need to use SQL.

Thanks
BJ

Msgbox Prompting User To Enter Something
HI All i m bAck@!

if i create a button in VB. lets say the button name is DELETE.. then once i click tat button.. i wan a box to pop out prompting user to enter someting into the box to delete.. how to create tat box?

Prompt User To Enter File Name
Hi!
I wanted to use an OutputTo function to save a file from access to html format. But I want my users to enter their desired file name, but not the path. so for exemple I want the path to be G:myfolder and then the user chooses the file name with a prompt. Here is a bit of code but I need your help for the prompt bit


Code:


DoCmd.OutputTo acReport, "EnvoiCommande", acFormatHTML,
this is wher I want the user to enter the file name, but not the path ,
False, ""



Thanx for any help...

Omit The Space For A Textbox
hi!
anyone know how to omit those space that user would like to key in the textbox????

thanks!!!

or is there any better suggestion how to know if or whether user have enter the space bar????

Disable Space Into A Textbox?
How can I disable space button when a user write text into a textbox? Or show a message if space is used?

Get Rid Of Automatic Space In Textbox
Hi guys!!

Need some help over here.......I am using VB 6.

I have a textbox, and on that textbox I do a validation(must have 8 digits). When I type in for example "12345678" it does not save because it is longer than 8 digits. Then I have found that when I type in something it adds a space at the end automatically "12345678 " so the system see it as 9 characters.

Is there something in the properties menu that I have to set to take it out or not putting it in?

THANKS!!

Enter In A TextBox
Hi @ all
I'm a novice, I need help to resolve a problem.
I have to insert data in a TextBox and when I press the Enter key I need to send that text to a cell and prepare the TextBox to receive new data.

Thank you

Textbox And Enter Key
I'm a newbie running VB 6.0, and have run up against a roadblock with my project. Basically, I have two textboxes. The first I'm using to enter text, which then gets sent to textbox 2 and appended to the text that's already there. I have it working currently so that hitting a command button performs this action. What I need now is to change the behavior of the Enter key so that it will do the same thing as hitting the button, rather that performing a carriage return. I need the textbox to be multiline and wrap, but hitting Enter should do the same as hitting the command button. Here's what I've got for what happens on button click.

Private Sub btn2_Click()

If textbox2.Text = "" Then
textbox2.Text = textbox.Text
Else: textbox2.Text = textbox2. _
Text & vbCrLf & textbox.Text
End If

textbox.Text = ""

End Sub


Thanks for any help!

Enter Key And Textbox
Hello,

I have a text box for the user to enter a term to search for,
there is also a button "Search", I need the script of the button
to be execute also when the user prerss the "Enter" key on
the keyboard, I did try these codes with no success :

Code:
Private Sub txtResult_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
MsgBox "Hello World"
End If
End Sub

Private Sub txtResult_KeyPress(KeyAscii As Integer)
MsgBox "Hello World"
End Sub

Private Sub cmdEnter_Click()
MsgBox "Hello World"
End Sub
Any ID's Y ?

Textbox &amp; Enter
I have some single line text boxes in a row. In the on keypress, I have added If KeyAscii = 13 Then SendKeys "{TAB}" so that it moves to the next text box when enter is pressed.The only problem is that it makes a "Bing" sound when you press enter. Is there a way of turning off the "Bing"? Or else, is there a way of changing the enter key behaviour?

Textbox TAB+ENTER
hello,
i got 2 questions

1)i have 3 text boxes 1 want when th ueser will press tab it will go to the other text box
2)i have a textbox and i want when you click enter (ascii code 13)
it will go a line down(vbCrLf)

thanks, kolem

Textbox Then Enter
I have text in the box!!!! Now, how do i click enter in the textbox and call a command buttone???


chat,,, type,,,, enter = send
So link the textbox so when you click enter it toggles the send command buttone or Winsock1.SendData Form2.txtSend & vbCrLf

Enter In TextBox
I would like the written text to have an enter everytime a new line is entered in a textbox.



Quote:




txtLoginInfo.Text = txtLoginInfo.Text & "Invalid Password Entered"






All the lines are just entered one after the other. Can someone give me instructions on how to add a break or an enter to a textbox?

Enter In Textbox?
Here's my dilemma. I want to add a certain string into a textbox (Text1.Text = Text1.Text & StringIWant), and in the StringIWant, I would like several linefeeds & return carriages (also known as enters). Chr(10) & Chr(13) both display as boxes, rather than actual linefeeds. I was wondering if any APIs would help. Or whatever. Sendkeys are not an option, sorry.

Thanks.

Enter In Textbox
Hi, (again)

When I put some numbers in a textbox, I have to push the tab key to get to the next textbox, Is there a way that when I hit the enter key I go to the next textbox?

Greetings from yet another rainy day in holland.....

Dropdown List With Additional Space For User Entry??
Hi there..

If you have a Dropdown list with predefined options like:
A , B , C , D AND a Space for the user entry which is not in the list.
I think you know what i mean .

How can I do this??

Thanx for reading/helping

Lyla.

KeyAscii - Check If User Pressed Enter?
Hello, I'm looking for a way to check if txtSearch has focus and a user has pressed enter. Yes, I have searched Google for KeyAscii values, and it seems there is one for space, but not for enter. Could anyone help me out here? Possibly give a code example for txtSearch_GotFocus()?

Thanks.

How Do I Allow The User To Enter A Desired Number Of Variables?
My program analyzes a tunnel and I need the user to be able to first of all tell me how many "sections" the tunnel has, the length of each section and the height of each section. So if the user says there are 3 sections I want three boxes to appear to enter their legnth and three more for their height. How do I do this?

User Enter/login For Chat Room
VB Code:
'user addedstruser = txtusernameLstTextFile.AddItem struser


that adds the user into the chat room, but how can i make that say, "(user) has just entered into the chat room"

React When User Press's Enter In Text Box
Hi, i dont know exactly what this is called, but i will do my best to describe. (By the way, i attempted to do a search, but as i dont know what it is called, it stumped me)

I want to react when the user hits return in the text box

Disabling A Combo Box So User Can't Enter Text
Is it possible to disable a combo box so that the user can not enter text but only make a selection from the items that are added in by the code?

Thanks again,

JEFF

Restricting User To Enter Only Date In Textfield?
How to get the date(dd/mm/yyyy) from the textfield which must accept only in this format and how to validate it?

Thks for the reply

But If i want to check is the date what user has entered is proper . On lost focus, if i am using MaskEdit and if this is the First control in the form on form load the lost focus gets fired what might be the solution

How To Restrict User Not To Enter More Than Two Decimal Places
Hi all
I have got a prob with this could u guys pls help me

How to restrict a user not to enter more than 2 digits after the decimal point in a textbox

thanks

Sri

Datagrid Force User To Enter Value In Certain Cell
i am working on a datagrid written in vb.net for a windows based application. if i have a boolean column (column 2) set to TRUE then the user does NOT need to enter in a comment in column 3. if the boolean column (column 2) is set to FALSE then the user MUST enter in a comment is column 3. how can i force the cursor to move over to column 3 when the column 2 boolean value is FALSE? is it on the datagrid_currentcellchanged event or something else?

any help would be appreciated

How To Read From TextBox Untill A Space
Lets say I wanted to add commands to something in a TextBox
Heres my Example

Private Sub LocalSendData_Click()
LocalWinsock.SendData Txt1.Text
End Sub

Then on the server side

Private Sub RemoteReciveData_DataArrival(ByVal bytesTotal As Long)
RemoteReciveData.GetData Data, vbString
cmd = Mid(data, 1, 3)
cmdtxt = Mid(data, 5)
Select Case cmd
Case "123"
Blah Blah Blah
'
Case "234"
Blah Blah Blah
'
End Select

Anyways what If I wanted to send 3 peices of data with infomation like lets say the data that came in was
Cmd Del File.Jpg
OR
Cmd Rename File.Jpg File2.Jpg

Now with those
cmd = Mid(data, 1, 3)
cmdtxt = Mid(data, 5)
It would not work I could always Shorten both commands to 3 letters but I want the user to type it Fully and come out on the other side Fully
Whats the command to read Word By Word, So Basicly Stop after a space is there a such thing?

Thanks =]

Copyright 2005-08 www.BigResource.com, All rights reserved