preventing certain characters from bein entered into TB


I need to limit input into a textbox to numbers "1-9", "." and "-"

I know have used the [isnumeric] code, but I don't think that works here.
I thought about using a compound If/Then statement....but I need to exclude everything but these characters. I really am not sure how to begin to approach limiting the input to numbers 1-9 and two other characters.

A REAL beginer here!
Posted On: Monday 24th of December 2012 01:16:07 AM Total Views:  309
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




Carbon vs Cocoa

Does RB have a plan to get off of the Carbon API and onto the Cocoa one Robert
VIEWS ON THIS POST

192

Posted on:

Wednesday 7th November 2012
View Replies!

Smooth Alternation between forms

, Need your help on how to achieve smooth transition between forms. I am using the show and hide as appropriate and that really works just fine. However, when the transition is made from one form to the other, one can see the actual drift which really does not look professional. I therefore seek you advise. Thank you always.
VIEWS ON THIS POST

254

Posted on:

Saturday 10th November 2012
View Replies!

data

:(!): how to view loadpicture in datareport....
VIEWS ON THIS POST

156

Posted on:

Wednesday 28th November 2012
View Replies!

Package and development wizard problem in vb6.0

I am a beginner for vb6.0 . My question is that : When i using the wizard to package my project in vb6.0 ,then the error code 70 appeared and then failed. Anyone can help me to find out the problem,..
VIEWS ON THIS POST

192

Posted on:

Wednesday 28th November 2012
View Replies!

case sensitive in tables

'ok button Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\Saurabh\My Documents\Versa Server 2008.mdb") Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM Login WHERE UserName = '" & UsernameTextbox.Text & "' AND PassWord = '" & PasswordTextbox.Text & "'", con) con.Open() Dim sdr As OleDbDataReader = cmd.ExecuteReader() ' If the record can be queried, Pass verification and open another form. If (sdr.Read() = True) Then MessageBox.Show("The user is valid!") Dim mainForm As New Form mainForm.Show() Me.Hide() Else MessageBox.Show("Invalid username or password!") End If End Sub End Class Mod Edit: Please use code tags when posting your code. Code tags are used like so =>
VIEWS ON THIS POST

102

Posted on:

Wednesday 28th November 2012
View Replies!

Runtime error6 while retreiving 16000+ records from oracle DB

I have a legacy application in vb6 where the no of records is fetched at a single stance...Now for other records where the no. of records are less like 3000+ or 5000+ its showing no error...but while retrieving 16000+ records, it takes a little time to execute the inline query and then gets some garbage data and finally throws runtime error 6... The data is populated in the grid using row-wise[arraywise]....I am not sure how much buffer memory can hold data from the oracle db....Now if I add a where clause i.e. minimizing the no. of records for same query....the grid is populate w/o any error.....But if I remove the clause it is getting over flown.... How can I increase the buffer memory or how can I avoid this issue...\t Any idea how to solve this....\t....
VIEWS ON THIS POST

230

Posted on:

Wednesday 28th November 2012
View Replies!

Browsing The VB Application

Hi How Can We Browse VB Application Through The IE Explorer. Beerin In Mind That It Is VB Aplication. There Is A Script To Do So But I Donot Know Where To Find it ... It Can Read Every Single Form With The VB Application Within The IE Explorer. (It Gives Read Only) Plz Help Me To Do SO Thankx
VIEWS ON THIS POST

83

Posted on:

Wednesday 28th November 2012
View Replies!

Next, rate... Do, Loop...

Ok so im doing my homework for my online Visual Basics class and I run into a code I can not seem to do right. The homework problem is... "Change the Next, Rate codes into Do, Loop codes." Now i have done most of the work but it is suppose to show the rate for 3yrs 4yrs and 5yrs but its only displaying the 3yr rate... need help please! Also i already know my code is ugly, im very new and its actually harder then expected hehe. Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click 'calculate monthly payments on a loan 'using terms of 3, 4 and 5 years and interest 'rates of 5% through 10% Const termheading As String = _ " 3 yrs 4 yrs 5 yrs" Dim principal As Double Dim monthlypayment As Double Dim isconverted As Boolean Me.xPaymentsLabel.Text = String.Empty isconverted = _ Double.TryParse(Me.xPrincipalTextBox.Text, principal) If isconverted Then 'display the term in the heading Me.xPaymentsLabel.Text = termheading _ & ControlChars.NewLine 'calculate and display payments Dim number As Double = 0.04 Do While number
VIEWS ON THIS POST

73

Posted on:

Wednesday 28th November 2012
View Replies!

problem with brick breaker

what i have is a brick breaker code(only 1 layer of bricks so far) but when the ball is coming at the paddle if you get it right on the edge it like goes right through the paddle. also when the ball goes to hit the bricks it gets rid of them but doesn't bounce off of them it goes to the top then bounces off making it so that you almost always get 2 bricks at a time heres my full code Public Class form1 Dim x As Integer ' Move a paddle by the mouse ' With a bouncing ball ' bricks Dim z(16) As Boolean ' module variables -- these variables exist across Subs Dim px, py As Integer ' establish a variable called paper of type Graphics Dim paper As Graphics ' ball position variables Dim bx, by, bdx, bdy, n As Integer ' horizontal mouse position Dim mousex, oldmx As Integer ' maximum of picture box Dim xmax, ymax As Integer Const paddleheight As Integer = 10 Const paddlewidth As Integer = 40 Private Sub start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles start.Click Me.Cursor.Dispose() setstuff() End Sub Private Sub setstuff() z(1) = False z(2) = False z(3) = False z(4) = False z(5) = False z(6) = False z(7) = False z(8) = False z(9) = False z(10) = False z(11) = False z(12) = False z(13) = False z(14) = False z(15) = False z(16) = False ' set paper = to the existing picture box ' (which we named picBox in the form) paper = PictureBox1.CreateGraphics() ' make the picture box all white paper.Clear(Color.White) ' top left coordinates of paddle ' horiz is center - 20 px = PictureBox1.Width / 2 - 20 ' vertical is py = PictureBox1.Height - 40 paper.FillRectangle(Brushes.Green, px, py, paddlewidth, paddleheight) ' initial values for ball bx = 35 ' x,y is coordinates of top left corner by = 20 bdx = 2 ' change in x each tick bdy = 1 ' change in y each tick ' initial horizontal value for mouse oldmx = Control.MousePosition.X ' right and bottom sides of picturebox xmax = PictureBox1.Width ymax = PictureBox1.Height ' display the ball paper.FillEllipse(Brushes.Blue, bx, by, 20, 20) paper.FillRectangle(Brushes.Red, 0, 0, 40, 10) paper.FillRectangle(Brushes.Red, 42, 0, 40, 10) paper.FillRectangle(Brushes.Red, 84, 0, 40, 10) paper.FillRectangle(Brushes.Red, 126, 0, 40, 10) paper.FillRectangle(Brushes.Red, 168, 0, 40, 10) paper.FillRectangle(Brushes.Red, 210, 0, 40, 10) paper.FillRectangle(Brushes.Red, 252, 0, 40, 10) paper.FillRectangle(Brushes.Red, 294, 0, 40, 10) paper.FillRectangle(Brushes.Red, 336, 0, 40, 10) paper.FillRectangle(Brushes.Red, 378, 0, 40, 10) paper.FillRectangle(Brushes.Red, 420, 0, 40, 10) paper.FillRectangle(Brushes.Red, 462, 0, 40, 10) paper.FillRectangle(Brushes.Red, 504, 0, 40, 10) paper.FillRectangle(Brushes.Red, 546, 0, 40, 10) paper.FillRectangle(Brushes.Red, 588, 0, 40, 10) paper.FillRectangle(Brushes.Red, 630, 0, 40, 10) ' hide the Start button start.Visible = False ' Set timer to tick every 10 milliseconds Timer1.Interval = 10 ' start timer Timer1.Start() End Sub Sub Restart(ByVal program As String) For Each proc As Process In Process.GetProcesses If proc.ProcessName = program Then proc.Kill() Next Process.Start(program) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ' update ball ' erase the previous circle paper.FillEllipse(Brushes.White, bx, by, 20, 20) ' change the position bx = bx + bdx by = by + bdy 'see if the ball is hitting the paddle If by = 0 And bx = 42 And bx = 84 And bx = 126 And bx = 168 And bx = 210 And bx = 252 And bx = 294 And bx = 336 And bx = 378 And bx = 420 And bx = 462 And bx = 504 And bx = 546 And bx = 588 And bx = 630 And bx oldmx And px < xmax - paddlewidth Then ' erase paddle paper.FillRectangle(Brushes.White, px, py, paddlewidth, paddleheight) ' move paddle right px = px + (mousex - oldmx) ' draw new paddle paper.FillRectangle(Brushes.Green, px, py, paddlewidth, paddleheight) End If ' save location of mouse pointer for comparison oldmx = mousex End Sub Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class thnx john
VIEWS ON THIS POST

324

Posted on:

Wednesday 28th November 2012
View Replies!

SAVING DATA USING SAVE BUTTON

I WANT IF USER CLICK ON SAVE BUTTON ALL THE INFORMATION OF MSHFLEX GRID SHOULD ADD ON MR TABLE WHEN USER CLICK SAVE BUTTON OF MR FORM BUT IT IS NOT SAVING PROPERLY . CODE : Private Sub Command1_Click() Dim nm As String ' Debug.Assert False On Error GoTo err Set rs1 = New Recordset rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic ' rs1.Open " SELECT * FROM MR WHERE Product_id = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenDynamic, adLockOptimistic rs1.AddNew rs1.Fields(1) = Combo1.Text rs1.Fields(2) = Text1.Text rs1.Fields(3) = Text2.Text rs1.Fields(4) = Text3.Text rs1.Fields(5) = Text4.Text rs1.Fields(6) = "#" & DTPicker2.Value & "#" rs1.Fields(7) = CStr(Text6.Text) rs1.Fields(8) = Text7.Text rs1.Fields(9) = "#" & DTPicker1.Value & "#" rs1.Fields(10) = Text13.Text rs1.Fields("qty") = FlexGridEditor.Value ' rs1.Fields.Item(fldProductName).Value = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "") rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & " ") rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "") rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "") rs1.Update MsgBox ("Commit") rs1.Close Exit Sub err: MsgBox "Error in Command1_Click()" & vbCrLf & err.Number & vbCrLf & err.Description End Sub KINDLY FIND THE ATTACHMENT Attached File(s) Assignment.zip (23.66K) Number of downloads: 133
VIEWS ON THIS POST

80

Posted on:

Thursday 29th November 2012
View Replies!

Calculator Style Input method

Ok thanks for all your support in the past! Just a question on input.. I've 10 buttons with the value of 0 to 9 I want it so that if the user presses 1 then the out put will be 0.01, then again would be 0.11, and finally again 1.11 so bascially the input is formatted to 2 decimal places. Im stumped on this one, I think i may have something to do with Len but im not sure. Any way, Heres what little code i have.. Calc1 = Calc1 + "9" Calc is a textbox.. Im really sorry i've got nothing else, to go on.. Hope you can help!
VIEWS ON THIS POST

91

Posted on:

Thursday 29th November 2012
View Replies!

Setting values in Active directory

I'm trying to write an application that will quickly create an account in AD for me rather than going through all the tedious steps of creating it manually. I'm very new to AD and quite new to VB.net as well so there must be something obvious i'm missing. Here is the code im using: Public Shared Function GetDirectoryEntry() As DirectoryEntry Dim de As DirectoryEntry = _ New DirectoryEntry("LDAP://DomainControllerName/OU=Users,OU=CPG,DC=amd,DC=com", "mydomain\myusername", "mypass") Return de End Function Public Sub UserExists(ByVal Username As String) Dim ADSearch As New DirectorySearcher() Dim de As DirectoryEntry = GetDirectoryEntry() ADSearch.SearchRoot = de ADSearch.Filter = "(sAMAccountName=" & Username & ")" 'ADSearch.PropertiesToLoad.Add("homedirectory") Dim ADResult As SearchResult = ADSearch.FindOne() Dim ADEntry As DirectoryEntry = New DirectoryEntry(ADResult.Path) MessageBox.Show(ADEntry.Properties("homedirectory").Value.ToString) ADEntry.Properties("homedirectory").Value = "this is a test" MessageBox.Show(ADEntry.Properties("homedirectory").Value.ToString) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click UserExists("some_user") End Sub My problem is, I can't seem to write anything to Active directory although I can read from it just fine. I understand that you need to have an account that has the correct permissions to make changes to AD which I do, the same credentials I use in this program work fine using the AD MMC snap in to make changes. In the code above, I check the users homedirectory, and the code displays what is currently set in AD, but then I make a change to the homedirectory value and then read the value again from AD, and it displays what I changed it to, in the case above, when I read the homedirectory value again, it displays "this is a test" which is what I would expect. When I actually check AD using the MMC, there is never an update to the homedirectory, can anyone help with this or have an idea what I am doing wrong
VIEWS ON THIS POST

154

Posted on:

Thursday 29th November 2012
View Replies!

Visual Basic 2005 EE vs Visual Basic 2005

Whats the difference between the two. I heard from this guy at a Computer Store who said that the full version costed around R3000(ZAR (go to xe.com for a conversion)) and i here from a friend that the debuggers just a bit better and that there are a few more commands. but i don't see much of a difference between the two. right now i am working in The Express Edition(EE) and it works just fine for me. so is the full version worth the buy.
VIEWS ON THIS POST

81

Posted on:

Thursday 29th November 2012
View Replies!

use of default signature from outlook olmail

i have written a program which creates an automatic email using outlook object. I want to include the default signature configured in outlook. plz help
VIEWS ON THIS POST

172

Posted on:

Thursday 29th November 2012
View Replies!

ToolTipText in a Grid

Hi , I have a grid that I use to display records from a table. There are some fields that are long and I am unable to see the whole text in the cells I want to have a ToolTipText that when I click on a particular cell of the grid the ToolTip comes up and display that field. How to have that Or either another solution is ok, not neccessary a ToolTipText but just to display the whole column. Please help! Thank you very much in advance.
VIEWS ON THIS POST

95

Posted on:

Thursday 29th November 2012
View Replies!

Opening CSV file and Placing it into Workbook - create macro

hi ! I would appreciate some help! My goal is to create a vba to import filtered data into a workbook. Ex: Open Workbook TREAS , create macro, open CSV file named "Notes.csv" Once notes is open, delete row 2. Select row 1 and filter this. Select G1 and filter by A to Z Once done, select all data in Notes.CSV "CTRL+SHIFT+END" which selects all data in this file. Copy Paste into Workbook Tab TREAS.xls starting V38 Close Notes.csv - do not save I would appreciate any help, im new with vba.
VIEWS ON THIS POST

163

Posted on:

Thursday 29th November 2012
View Replies!

Using LIKE in SQL Statement

I am developing a library application using VB 6.0 As front end and Microsoft Access as Back end. I want to search by keywords and i have used the following SQL statement in VB "SELECT * From Daily_Book WHERE Bookname Like' "& Text1.Text & " ' %" Daily_Book is my table name and Bookname is the column name. I want to enter the keyword in Text1.Text (say C++) And search all books with C++ in the table Daily_Book I executed the above code ..it gives me syntax errors....
VIEWS ON THIS POST

81

Posted on:

Friday 30th November 2012
View Replies!

Problem with reversing string in vba

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim word As String, n As Long, i As Long, rev As String word = TextBox1.Text n = Len(word) For i = n To 1 Step -1 rev = Mid(word, i, 1) rev = TextBox2.Text Next i End Sub End Class I have to reverse the text which is entered in the TextBox1 into the TextBox2. I can not use reverse function. This code should work in my opinion, but it does nothing. It does not report error, just does nothing. I am a total newby, so i hope someone would help me.
VIEWS ON THIS POST

170

Posted on:

Friday 30th November 2012
View Replies!

login in msaccess

Sir,i hve create small application in access thats a internal project time manaement and that application entrance is login and logoff cammoand button pls help me i want one command button in logon and logoff And when i click logon button and it will be change log off and pls send this code pls plsss
VIEWS ON THIS POST

130

Posted on:

Friday 30th November 2012
View Replies!

where i can find crystal report tutorial?

Dear i have a project for reporting..and i want to used crystal report 9.do you know where i can find the full tutorial..i expected free tutorial or guide lines book
VIEWS ON THIS POST

252

Posted on:

Friday 30th November 2012
View Replies!

how to put square at the end of a word

Im am wondering how to put a square at the end of a word. To understand what im sayin this what I want to do. 100 sq/mi2
VIEWS ON THIS POST

70

Posted on:

Friday 30th November 2012
View Replies!

How to send sms Through Visual Basic 6.0?


VIEWS ON THIS POST

73

Posted on:

Friday 30th November 2012
View Replies!

standard calculator making

Private Sub Command1_Click() Text1.Text = Text1.Text + "1" End Sub Private Sub Command10_Click() Text1.Text = Text1.Text + "0" End Sub Private Sub Command11_Click() Text1.Text = Text1.Text + "." End Sub Private Sub Command14_Click() num1 = Val(Text1.Text) num2 = Val(Text1.Text) result = num1 + num2 Text1.Text = result End Sub Private Sub Command16_Click() Text1.Text = "" End Sub Private Sub Command17_Click() End End Sub Private Sub Command2_Click() Text1.Text = Text1.Text + "2" End Sub Private Sub Command3_Click() Text1.Text = Text1.Text + "3" End Sub Private Sub Command4_Click() Text1.Text = Text1.Text + "4" End Sub Private Sub Command5_Click() Text1.Text = Text1.Text + "5" End Sub Private Sub Command6_Click() Text1.Text = Text1.Text + "6" End Sub Private Sub Command7_Click() Text1.Text = Text1.Text + "7" End Sub Private Sub Command8_Click() Text1.Text = Text1.Text + "8" End Sub Private Sub Command9_Click() Text1.Text = Text1.Text + "9" End Sub Private Sub Picture1_Click() End Sub Mod Edit: Please use code tags when posting your code, like so
VIEWS ON THIS POST

126

Posted on:

Monday 3rd December 2012
View Replies!

vbkeylogger

Every one. i have made key logger and it works fine,but now my problem is that it's not working before user logon,here i am using xp.i have used GetAsyncKeyState() funvtion.and it is not work with system user.i hope some one knows how to get rid of it.
VIEWS ON THIS POST

88

Posted on:

Sunday 23rd December 2012
View Replies!

how to save this

i am making something for my litlle sister for a game called "yoville" she is colecting all the furniture of 1 theme now i have the code on howmuch she still ahs to pay but now i need it to save what is checked and what is unchecked part of my code (of the checkbox) If Check9.Value = 1 Then Label1.Caption = Label1.Caption - 2000 Else Label1.Caption = Label1.Caption + 2000 End If label1.caption is the max price she has to pay wich now is 6800 whitout anything checked now i need a code to save it so when she opens it again the saem checkboxes are still ticked/unticked a friend told me saving it as a .xml could work but he didnt know how a other freind said something about .txt files but i dont know please help me This post has been edited by dimpa3: 25 April 2009 - 08:29 AM
VIEWS ON THIS POST

253

Posted on:

Sunday 23rd December 2012
View Replies!