Computing.Net > Forums > Programming > Preformatted txt boxes in vb

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Preformatted txt boxes in vb

Reply to Message Icon

Name: Eriedor
Date: December 15, 2003 at 13:09:54 Pacific
OS: win xp
CPU/Ram: 512 2100xp
Comment:

hi, i cant find any threads relating to this so had to start a new 1.


basically wht i need is a text box tht is preformatted for entry by the user for the date.

for example the text box is formatted

,,:,,:,,
or
,,/,,/,,

wher the forward slashes or colons are permenantly fixed ther and the cursur moves around thm.

The reason for this is i have a program with a vb frontend and an access database for data store. and i need to make sure tht the date is entered each time in the same format. ty in advance



Sponsored Link
Ads by Google

Response Number 1
Name: rb79
Date: December 15, 2003 at 13:15:55 Pacific
Reply:

Why don't you use the Microsoft Calendar control? The user will always have to select a valid date and you can convert the date to be entered in your DB to the DB's requirements. Otherwise you might have to create a new textbox control.
But why would you make life difficult for your users and yourself?


0

Response Number 2
Name: eriedor
Date: December 15, 2003 at 13:35:07 Pacific
Reply:

sounds like best idea tbh.

.....how would i do tht *ahem* sorry im still learning vb :p


Also my next task in the program is a simple timetable. wher each day has a listbox and the jobs for tht day are listed.

Any ideas of how i might be able to accomplish this. Im using sql to interface my DB, but the thing tht i think cud be hard is reading the date and adding on 7 days to it as the user cycles forward week by week, without making a complex algorithm to it follows so it knows whn the week spreads over a change of month.


0

Response Number 3
Name: egkenny
Date: December 15, 2003 at 20:32:01 Pacific
Reply:

The following works with VB 6.0

The DateTimePicker control is part of a group of ActiveX controls that are found in the MSCOMCT2.OCX file.

To add in select:
Project
Components
Check "Microsoft Windows Common Controls-2.6.0"
Select OK

DateTimePicker formats: Long date, Short date, Time, and custom
Long date example: Monday, December 15, 2003
Short date example: 12/15/2003
Time example: 10:01:23 PM

Here is an example with a DateTimePicker control that has its date incremented by 7 days every time a button is clicked:

Private Sub Add7Button_Click()
CurrentDate = MyDatePicker.Value
NewDate = DateAdd("d", 7, CurrentDate)
MyDatePicker.Value = NewDate
End Sub


0

Response Number 4
Name: Stuart
Date: December 16, 2003 at 14:49:55 Pacific
Reply:

Although the Date/Time pickers works well another methed is to use the MaskEdBox. This will force the user to enter the date in a pre-determined format.

Using a mask of ##-???-#### the user will see __-___-___ and will have to enter the date in the format 16-Dec-2004. The hyphens are entered automatically.

The separator can be any of the characters recognised by VB including a space. The date entered can be sent to Access unaltered providing it conforms to the same format as set in Control Panel > Regional Options.

Stuart


0

Response Number 5
Name: Eriedor
Date: December 18, 2003 at 13:31:51 Pacific
Reply:

how do i use maskedbox??


0

Related Posts

See More



Response Number 6
Name: StuartS
Date: December 18, 2003 at 13:46:00 Pacific
Reply:

Click Project > Componants. Scroll down till you come to Microsoft Masked Edit Control. Tick it and add it to the tool box. Add it to the form like a standard text box. Highlight it and hit F1. It will bering up a help screen showing all the methods, events and properties associated with the Masked Edit control.

Stuart



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Preformatted txt boxes in vb

Code save file dialog box in vb.net www.computing.net/answers/programming/code-save-file-dialog-box-in-vbnet/18050.html

display ampersand in VB www.computing.net/answers/programming/display-ampersand-in-vb/8056.html

Read a txt file in Vb www.computing.net/answers/programming/read-a-txt-file-in-vb/7871.html