473,796 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple put current date in a txtbox in Formview - Gozirra

Using VS2005 w/ simple aspx in VB.net

I have a simple databound textbox "LastMtgTex t" in a formview in the Insert
template.

All I want to do is make the default date of today when someone goes to
Insert template so they do not have to put in todays date. Here is my code,
what am I doing wrong? I know how to do this when not using Formview.

'-----This puts in the current date

Dim dtmToday As Date

dtmToday = Now.Date
Dim convDate As String

convDate = CStr(dtmToday)
Dim LastMtgLabel As Label

LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")

LastMtgLabel.Te xt = dtmToday


Gozirra - I thought I understood what you were trying to teach me about
conversion so I thought this would be easy but I can not get this to work.
Can you please build a simple form and try this? This works fine when not
in Formview.
Oct 12 '06 #1
3 3752
I got it. But I have one last problem.

Dim dtmToday As String
dtmToday = Now.Date.ToStri ng("MM/d/yyy")

Dim LastMtgLabel As TextBox
LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")
LastMtgLabel.Te xt = dtmToday
This codes puts in today's date perfectly in my Textbox, but if I try to
change the date to something else like 12/15/1945 and Insert it, it posted
today's date. No matter what I change it to, it will post today's date. Is
there a reason for this? This code was in the PageLoad so why would it do
this?


"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:uR******** ******@TK2MSFTN GP02.phx.gbl...
Using VS2005 w/ simple aspx in VB.net

I have a simple databound textbox "LastMtgTex t" in a formview in the
Insert template.

All I want to do is make the default date of today when someone goes to
Insert template so they do not have to put in todays date. Here is my
code, what am I doing wrong? I know how to do this when not using
Formview.

'-----This puts in the current date

Dim dtmToday As Date

dtmToday = Now.Date
Dim convDate As String

convDate = CStr(dtmToday)
Dim LastMtgLabel As Label

LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")

LastMtgLabel.Te xt = dtmToday


Gozirra - I thought I understood what you were trying to teach me about
conversion so I thought this would be easy but I can not get this to work.
Can you please build a simple form and try this? This works fine when not
in Formview.

Oct 12 '06 #2
I had the same problem, thanks for your help.
This one works for me (put in the if Not IsPostBack..... End if).
I can change the date now en it submits correctly to the database.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim dtmToday As String
If Not IsPostBack Then
dtmToday = Now.Date.ToStri ng("dd/MM/yy")
Dim LastMtgLabel As TextBox
LastMtgLabel = FormView1.FindC ontrol("datumTe xtBox")
LastMtgLabel.Te xt = dtmToday
End If
End Sub
Phillip Vong wrote:
I got it. But I have one last problem.

Dim dtmToday As String
dtmToday = Now.Date.ToStri ng("MM/d/yyy")

Dim LastMtgLabel As TextBox
LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")
LastMtgLabel.Te xt = dtmToday
This codes puts in today's date perfectly in my Textbox, but if I try to
change the date to something else like 12/15/1945 and Insert it, it posted
today's date. No matter what I change it to, it will post today's date. Is
there a reason for this? This code was in the PageLoad so why would it do
this?


"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:uR******** ******@TK2MSFTN GP02.phx.gbl...
Using VS2005 w/ simple aspx in VB.net

I have a simple databound textbox "LastMtgTex t" in a formview in the
Insert template.

All I want to do is make the default date of today when someone goes to
Insert template so they do not have to put in todays date. Here is my
code, what am I doing wrong? I know how to do this when not using
Formview.

'-----This puts in the current date

Dim dtmToday As Date

dtmToday = Now.Date
Dim convDate As String

convDate = CStr(dtmToday)
Dim LastMtgLabel As Label

LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")

LastMtgLabel.Te xt = dtmToday


Gozirra - I thought I understood what you were trying to teach me about
conversion so I thought this would be easy but I can not get this to work.
Can you please build a simple form and try this? This works fine when not
in Formview.
Oct 20 '06 #3
That's perfect!

Thanks!

"MrGreen" <re******@hotma il.comwrote in message
news:11******** ************@i3 g2000cwc.google groups.com...
>I had the same problem, thanks for your help.
This one works for me (put in the if Not IsPostBack..... End if).
I can change the date now en it submits correctly to the database.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim dtmToday As String
If Not IsPostBack Then
dtmToday = Now.Date.ToStri ng("dd/MM/yy")
Dim LastMtgLabel As TextBox
LastMtgLabel = FormView1.FindC ontrol("datumTe xtBox")
LastMtgLabel.Te xt = dtmToday
End If
End Sub
Phillip Vong wrote:
>I got it. But I have one last problem.

Dim dtmToday As String
dtmToday = Now.Date.ToStri ng("MM/d/yyy")

Dim LastMtgLabel As TextBox
LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")
LastMtgLabel.T ext = dtmToday
This codes puts in today's date perfectly in my Textbox, but if I try to
change the date to something else like 12/15/1945 and Insert it, it
posted
today's date. No matter what I change it to, it will post today's date.
Is
there a reason for this? This code was in the PageLoad so why would it do
this?


"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:uR******* *******@TK2MSFT NGP02.phx.gbl.. .
Using VS2005 w/ simple aspx in VB.net

I have a simple databound textbox "LastMtgTex t" in a formview in the
Insert template.

All I want to do is make the default date of today when someone goes to
Insert template so they do not have to put in todays date. Here is my
code, what am I doing wrong? I know how to do this when not using
Formview.

'-----This puts in the current date

Dim dtmToday As Date

dtmToday = Now.Date
Dim convDate As String

convDate = CStr(dtmToday)
Dim LastMtgLabel As Label

LastMtgLabel = FormView1.FindC ontrol("LastMtg TextBox")

LastMtgLabel.Te xt = dtmToday


Gozirra - I thought I understood what you were trying to teach me about
conversion so I thought this would be easy but I can not get this to
work.
Can you please build a simple form and try this? This works fine when
not
in Formview.

Oct 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1439
by: Bruce Duncan | last post by:
I know this should be simple...but for some reason my brain isn't working. I want my users to enter a the date in three seperate boxes. After the users enters in two digits for the month I want the cursor to move to the day textbox and so on.... I was using simple code...but onKeyPress occurs before the value changes...can anyone help me? my code:
2
2288
by: Tu Quach | last post by:
Hi there, how are you? I have question, assume I have a text box and gave it a format date&time, how can I check when it is empty or not empty I use the code as if frm_form!txt_name1 = Null then msgbox "1" else msgbox "2" end if
4
1451
by: merlin | last post by:
greetings to all. i am new to the group and to access. I am using access 97 to setup our clinic's database and in one of the tables I need to be able to type in a date only in terms of the Month/Year format? How do I do that? I can't seem to be able to find this either through the help file or with playing around with the properties. I know it's a silly one but we all have to start from as low as this lol :) thanks in advance
2
956
by: Bradley | last post by:
I want to set the scroll bar and cursor the bottom of a constantly updating textbox. I am under the impression that: txtBox.SelectionStart = txtBox.TextLength should do the trick, but it doesn't have any impact. Any suggestions? TIA Brad
2
2109
by: David Veeneman | last post by:
What's the simplest way to format a date in a FormView control? I've been looking for something like a DataFormatString property, but it doesn't look like the control itself, nor the consitutent controls in its templates, has a property like that. What I want to do is apply a ShortDate format to a date value. What's the best way to handle this? Thanks in advance. -- David Veeneman
1
1133
by: Phillip Vong | last post by:
I have a simple Formview and in the InsertMode I have a calendar and a textbox. All I want is for people to click on a date and the date is populated to the textbox. Here is my simple code and my problem is converting the DateTxtBox to a date format. Can someone show me how to do this simple conversion? Thanks! Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As
2
2388
by: sck10 | last post by:
Hello, I have 3 objects: LinkButton GridView FormView The LinkButton is used to open the FormView in Insert mode. The GridView provides a list of products. When the "Select" link is
7
2373
by: dunkleypilot | last post by:
Hello, I have created a database to track the flights on three aircraft owned by the flight school I manage. The relevant fields in the FlightRecords table are Date, AircraftID, HourMeterOut, and HourMeterIn. - = TotalFlightTime. Each month I generate a report that calculates the total flight time for each aircraft. That report calls a Dialog box which has BeginDate and EndDate, BeginHourMeter (which is the first HourMeterOut value for...
7
2033
by: buddyr | last post by:
Hello, txtbox one has a date. txtbox two has a number. number is number of days) txtbox three is empty. I have alot more going on but this is my question: can I add txtbox1 + txtbox2 and show answer in txtbox3? example: txtbox1 - 1/2/2008 txtbox - 2 txtbox3 -1/4/2008
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.