Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a MaskEdit TextBox value to a variable

Status
Not open for further replies.

FoxT2

MIS
Oct 3, 2003
143
US
Hello,

I am using a MaskEdit TextBox with ##/##/#### in the mask property on my form to receive date entries like 01/01/2004, 03/15/2004 because you cannot mask regular textboxes (At least that is how it was explained to me). How do I pass the value of a MaskEdit TexBox to another variable or object? I have tried the following and it does not work....

Label4.Text = "'" & txtreceived.SelText & "'"
Label4.Text = "'" & txtreceived.Text & "'"
Label4.Text = txtreceived.SelText
Label4.Text = txtreceived.Text
Dim s As String = "'" & txtreceived.SelText & "'"
Dim s As String = "'" & txtreceived.Text & "'"
Dim s As String = txtreceived.SelText
Dim s As String = txtreceived.Text

unless I am missing something here, none of the above seemed to worked. Also, it seems to me that it is a complicated process handling date values and date entries in VB. I guess I'm spoiled from using Visual FoxPro for so many years. In VFP I can mask any textbox and format it for date values. And I can easily pass the value to another variable like this...

MyVar = Form1.TextBox1.value

and be done with it. How are the rest of you handling date formatted textboxes for data entry?

Thanks,

FoxT

 
Are you in vb.net? There is a new function called regex (Regular Expressions) that you might want to check out.
 
Yes I am in VB.Net, however I found another solution. There is a dll file for a textbox called flexmaskeditbox which has the properties to achieve this. I still do not understand why the native VB textbox has so few properties to control the user inputted text. I am relying on activex controls to build my forms. Seems like a lot of extra work to me. In Foxpro all the native forms controls had enough properties to do these things. Like Masking ##/##/####, Formatting for uppercase only, Formatting for numeric only. Do VB'ers find it better to code these things like this
With Form1.DefInstance.txtname
.Text = UCase(.Text)
End With

vs. setting a property of a TextBox like TexBox.Format='!' for uppercase only? If so why? More control?

FoxT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top