|
Is there are a way to put an input mask or some type of validation on a text box?
I either want to stop anything apart from upper and lowercase letters as they are typing in the box
or
Load an event on a button press if anything except uppercase and lowercase is in the box.
Any ideas?
Cheers in advance
|
|
|
|
|
can write code to validate the text input in 'key press' event or 'change event' or 'lost focus' event of text box
Ex. for key press event (using VB6)
if (keyascii >= 65 and keyascii <= 90) and (keyascii >= 97 and keyascii <= 122) then
.....
else
.....
end if
Regards
KP
|
|
|
|
|
In VB 2005 you can use a masked edit control. In earlier versions, you have to handle the KeyPress event and set e.Handled to true if the key is one you want to reject.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, sorry, forgot to mention, its for VB.NET 2005.
How does the mark edit control work? I have looked on MSDN but it doestn really help.
I guess its nothing like excel's input mask!?
|
|
|
|
|
MSN has full documentation on how to write input masks for the masked input control. I don't really know, I always write my own code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
A total newbie to Visual Basic and Macros ( as in never touched upon both ), so forgive me if I get anything wrong.
Right now I'm in a project, trying to map an entire enterprise network with Visio. The network has over >10,000 network devices, ie. switches, routers, firewalls, etc. There are some frequent changes to the network topology, therefore by the time I do finish a network diagram, there's a good possiblity of something changing. Also I wish for the diagram to be more "dynamic".
My question is this: Is it possible to use either VB or a macro to test connectivity between each network device? If the connection is live, then the line on the network diagram between the devices would be black, otherwise it will be red. One condition is that I would strongly prefer not to log on to any devices. I don't want the actual code as I would like to learn this myself. I'm just curious as to if something like this is possible.
Thanks for any info.
|
|
|
|
|
You can probably shell out to TRACERT, if you don't have a COM component to test for you, and parse the repsonses you get back from it. You could probably do some work testing certain routes if you use the -J switch to give TRACERT a list of routers to pass the test packet through.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi everyone:
Is there a way that I can make the icons on the listview bigger? I tried setting them to large icon, but, they still seemed quite small. I really just want a list of pictures with no text, that would be perfect.
Regards,
James
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
I'm assuming by "setting them to large icon" you changed the View property of the listview? Is that right?
How big are the icons you are using? 16x16? If that's the case, you may have to use bigger icons than 16x16.
|
|
|
|
|
Hello,
I want to buy vb6.0 and .net also can any body help me in finding best deal . also if there is some way I can install it for free.
Thank you
ciacia
|
|
|
|
|
there r many links on the internet
vb.net express edition is absolutely free.
use bittorrent client to download it.. it is the safest bet
|
|
|
|
|
can you please geive me exact link for downloading vb.net and asp.net for free
|
|
|
|
|
The only place you're going to find VB6 is if you buy it off EBay. It hasn't been available for retail for about 5 years now.
ASP.NET can be had, along side the VB.NET Express Edition, as Visual Web Developer Express Edition. Both of which you can find here[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
the problem is that,that whenever i use navigation buttons(which i built using currency manager)..the radio button that i checked earlier during the save stage
dont show up,, rather the default button always appeared checked(which i selected during design))))please help....
how to bind radio buttons wid currency manager
here is the full code of the page that i m designing n coding
Imports System.Windows.Forms.Form
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlCommand
Public Class vendor
Inherits System.Windows.Forms.Form
Dim objsqlconn As SqlConnection
Dim objsqlcmd As SqlCommand
Dim ds As DataSet
Dim adp As SqlDataAdapter
Dim dv As DataView
Dim objcurrencymanager As CurrencyManager
Private Sub fill()
ds = New DataSet
objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
adp = New SqlDataAdapter("select * from vendordetails", objsqlconn)
adp.Fill(ds, "vendordetail")
dv = New DataView(ds.Tables("vendordetail"))
objcurrencymanager = CType(Me.BindingContext(dv), CurrencyManager)
End Sub
Private Sub bind()
TextBox1.DataBindings.Clear()
TextBox2.DataBindings.Clear()
TextBox3.DataBindings.Clear()
TextBox6.DataBindings.Clear()
TextBox7.DataBindings.Clear()
TextBox5.DataBindings.Clear()
TextBox4.DataBindings.Clear()
'Add new binding
TextBox1.DataBindings.Add("text", dv, "venname")
TextBox2.DataBindings.Add("text", dv, "id_vendor")
TextBox3.DataBindings.Add("text", dv, "phone")
TextBox6.DataBindings.Add("text", dv, "address")
TextBox7.DataBindings.Add("text", dv, "productname")
TextBox5.DataBindings.Add("text", dv, "product_id")
TextBox4.DataBindings.Add("text", dv, "totnoofpurch")
'display a status bar
StatusStrip1.Text = "Ready"
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call fill()
Call bind()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
objsqlcmd = New SqlCommand
objsqlcmd.Connection = objsqlconn
objsqlcmd.CommandText = "insert into vendordetails(venname,id_vendor,phone,address,purchasetype,productname,product_id,totnoofpurch) values(@venname,@id_vendor,@phone,@address,@purchasetype,@productname,@product_id,@totnoofpurch)"
objsqlcmd.CommandType = Data.CommandType.Text
If TextBox1.TextLength = 0 Or TextBox2.TextLength = 0 Or TextBox3.TextLength = 0 Or TextBox4.TextLength = 0 Or TextBox5.TextLength = 0 Or TextBox6.TextLength = 0 Or TextBox7.TextLength = 0 Then
MsgBox("you have not completed the form")
Else
objsqlcmd.Parameters.AddWithValue("@venname", TextBox1.Text)
objsqlcmd.Parameters.AddWithValue("@id_vendor", TextBox2.Text)
objsqlcmd.Parameters.AddWithValue("@phone", TextBox3.Text)
objsqlcmd.Parameters.AddWithValue("@address", TextBox6.Text)
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
Dim b As String
Select Case True
Case Is = RadioButton1.Checked
b = RadioButton1.Text
Case Is = RadioButton2.Checked
b = RadioButton2.Text
End Select
objsqlcmd.Parameters.AddWithValue("@purchasetype", b)
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
objsqlcmd.Parameters.AddWithValue("@productname", TextBox7.Text)
objsqlcmd.Parameters.AddWithValue("@product_id", TextBox5.Text)
objsqlcmd.Parameters.AddWithValue("@totnoofpurch", TextBox4.Text)
objsqlconn.Open()
Dim m As Integer = objsqlcmd.ExecuteNonQuery()
MsgBox(m & "no. of row inserted")
objsqlconn.Close()
End If
If TextBox1.Text = "" Then
TextBox1.Focus()
ElseIf TextBox2.Text = "" Then
TextBox2.Focus()
ElseIf TextBox3.Text = "" Then
TextBox3.Focus()
ElseIf TextBox4.Text = "" Then
TextBox4.Focus()
ElseIf TextBox5.Text = "" Then
TextBox5.Focus()
ElseIf TextBox6.Text = "" Then
TextBox6.Focus()
ElseIf TextBox7.Text = "" Then
TextBox7.Focus()
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
objcurrencymanager.Position = 0
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
objcurrencymanager.Position = objcurrencymanager.Count - 1
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
objcurrencymanager.Position -= 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
objcurrencymanager.Position += 1
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
End Sub
End Class
|
|
|
|
|
|
I have a combo box with the system fonts in it, how do I get it to show a font when I start typing, ie typing ar will bring up Arial, tim will bring up Times New Roman etc
|
|
|
|
|
heres a snippet from a prog a wrote in vb6
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const CB_ERR = (-1)
Public Const CB_FINDSTRING = &H14C
Private Sub Combo1_Keypress(Keyascii As Integer)
Dim CB As Long
Dim Findstring As String
If Keyascii <32 Or Keyascii > 127 Then Exit Sub
If Combo1.Sellength = 0 Then
Findstring = Combo1.Text & Chr$(Keyascii)
Else
Findstring = Left$(Combo1.Text, Combo1.Selstart) & Chr$(Keyascii)
End If
CB = Sendmessage(Combo1.hwnd, CB_FINDSTRING, -1, Byval Findstring)
If CB <> CB_ERR Then
Combo1.Listindex = CB
Combo1.Selstart = Len(Findstring)
Combo1.Sellength = Len(Combo1.Text) - Combo1.Selstart
End If
Keyascii = 0
End Sub
|
|
|
|
|
Cheers Stig will give it a go.
|
|
|
|
|
hello everyone
i have two images of a single finger , stored in byte arrays.
is there anyway i can compare them relatively..i mean is there something that can giv me the relative similarity or difference between the two byte arrays?
|
|
|
|
|
This will only happen if you either write the code to do the comparison or find a 3rd party library that does what you want. There is nothing in the .NET Framework that will do this for you.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hello everyone:
I have a quick question about rich text box controls in visual basic. I basically want to change the colour of the text in one of these controls, but I can't see another way to do it then use the "Select" command. This basically highlights text and then you can make whichever changes you want. The problem is of course that this has all sorts of unpredictable behaviors which can't be foreseen, and of course, its outright sloppy. The problem is I see no other way to edit the internal data easily! What's the standard correct way to do this sort of thing?
Regards,
James
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
Are you trying to change the color of all the text? or just a certain piece?
|
|
|
|
|
What you have now is about the only method you've got. ...Unless you want to start parsing the RTF string and inserting the formatting codes yourself.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Ah, that's too bad. Yeah, I only want to edit parts of it. Using the select method has such unpredicatable side effects, its a shame there is no provided control to get around that.
Thanks guys,
James
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
It's a simple implementation of a RichTextBox control. It's not meant to be something like Word. If you wanted more complex functionality, it would require a more complex implementation, like a 3rd party control or something you write yourself.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|