473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Masked date textbox

36
Hi,

I'm using Visual studio 2005 pro Ver..]]]
I have a Form named form1
textbox named txtName
masked textbox (Date Masked) named txtMaskedDate
and a button to add data named btnAdd


dim name as string
dim startdate as date

when i click the button

name=txtName.text
startdate=txtMaskedDate.text

but the thing is the user may input a date or may not

so when i leave the date field empty I get a error message "Cannot convert string to a date" what should i do??

I want the user to have the choice of enter a date or not to enter a date

Thank you
Aug 11 '07 #1
2 2080
kenobewan
4,871 Expert 4TB
Are they able to enter any date enter any date, e.g. 12/25/0033? Or could you just take today's date without having to ask? Doesn't sound like it - but you can use a calendar without the validation. This was a problem in a form I had a while ago. The problem is if you use a parameter in a stored procedure and you need to supply it a value. Outside a stored procedure:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL as string
  2. Dim CNData as connection
  3. set CNDATa= new connection
  4. ... Set connection properties to SQLServer
  5. strSQL="Update tbl_A Set dtActivation = NULL Where fldkey=X"
  6. CNData.execute strSQL
Or alternately if you pass "1/1/1900" to a stored procedure and then set
to NULL in the stored procedure. It all depends on where you want the
code to reside to do it.
Aug 11 '07 #2
gayano
36
Thank you
I try it when i go back to the office
Aug 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: orekinbck | last post by:
Hi There I have spent alot of time trying to get a masked text box to validate e-mails, but with no success. Mainly because I can't figure out how to account for the wide variety of different...
7
by: |{evin | last post by:
I'm currently working on what has turned in to something much larger that I wanted it to be. The upside is that I'm getting $$ to do it... but anywho. I currently have textboxes set up to...
1
by: Kostis | last post by:
Hello there! I have created a windows application in VB.NET and I want to retrieve data from an access database. I create the OleDbConnection, an OleDbAdapter, a dataset and finally a Data Form...
7
by: DazedAndConfused | last post by:
Curently I manualy code keypress edits. i.e. allow only 3 digits before decimal and two digits after decimal in .NET. Is there an easy solution to mask text boxes? The MSMASK32.OCX from vb6...
3
by: dmbuso | last post by:
I have a money field defined in a SQL Server 05 database with a value of 49.50. Also, it displays in SQL Server as 49.5000. I have a form in VB.NET 2005 and I'm using the new MaskedTextBox control...
3
by: gayano | last post by:
Hi, I'm using Visual studio 2005 pro Ver..]]] I have a Form named form1 textbox named txtName masked textbox (Date Masked) named txtMaskedDate and a button to add data named btnAdd dim...
2
mafaisal
by: mafaisal | last post by:
Hello Experts I am Using MaskedText Box For Entering Date And I Use MAsk is Shortdate My Question is How To Validate This MaskedtextBoxt if it is Valid Date or Not I try Using IsDate But That is...
0
by: michels287 | last post by:
I have a masked textbox on my form. I have an onscreen keyboard with numbers only. The masked format for the masked textbox is: (###) ### - #### I want to make sure they enter the phone...
3
by: buddyr | last post by:
Hello, I have a texbox with error provider control: if(textbox.text.length <=0) { errorprovider1.seterror(textbox,"enter part number"); } else { errorprovider1.seterror(textbox, "");
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.