469,900 Members | 1,513 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,900 developers. It's quick & easy.

Combining 2 variables

Brand new to .aspx, and just modifying code.

I have this:
writer.WriteLine("DTSTART:" &
beginDate.ToUniversalTime.ToString("yyyyMMdd\THHmm ss\Z") )

I am grabbing the date and time from two fields and just need to combine
them into one string for the above to work and I don't know how in .aspx.

Here are my fields I am trying to combine, it also look slike there
shouldn't be a space between them, looking at the above lines:

Dim beginDate as Date = Request.Form.GetValues("date")(0)
Dim beginTime as StartTime = Request.Form.GetValues("StartTime")(0)

So in other words, I need to append StartTime to beginTime so the whole
value will show up. This is for making an Outlook Celendar appointment,
BTW.
Nov 19 '05 #1
3 2298
FYI. You should be using ASP.NET Server controls and thus your ASPX
markup should look something like this. Please note that naming
convention can vary i just prefer Hungarian notation because it makes
long term maintainability alot easier.
<asp:TextBox Id="txtBeginDate" runat="Server" />
<asp:TextBox Id="txtBeginTime" runat="Server" />

Your codebehind should look something like this.
String strBeginDate = txtBeginDate.Text.Trim() + " " +
txtBeginTime.Text.Trim();
then you could say
DateTime FullBeginDate = DateTime DateTime.Parse(FullBeginDate); or
use a ParseExact variant, depending upon your needs.

Hope this helps to clear some stuff up and open some other avenues.

Nov 19 '05 #2
Still not quite getting it sorry.
I have these and it is pulling in the data correctly:
Dim beginDate as Date = Request.Form.GetValues("date")(0)
Dim beginTime as Date = Request.Form.GetValues("sTime")(0)

Now I just need to combine those two values into one varible, I didn't quite
understand that code.
Is there a way to just do something like
beginDate = beginDate + beginTime
or
beginDate = beginDate & beginTime

I also looked into the .append but I am guessing since I am dealing with a
date vs. a string this won't work???
This code is doing some conversion for me, but this is where I already need
the combined data:
writer.WriteLine("DTSTART:" &
beginDate.ToUniversalTime.ToString("yyyyMMdd\THHmm ss\Z") )

I hate to be a pain, but could you try (using my variable) shoot some more
code at me I can play with??

Thanks a million!!!

"re****@community.nospam" <ma**********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
FYI. You should be using ASP.NET Server controls and thus your ASPX
markup should look something like this. Please note that naming
convention can vary i just prefer Hungarian notation because it makes
long term maintainability alot easier.
<asp:TextBox Id="txtBeginDate" runat="Server" />
<asp:TextBox Id="txtBeginTime" runat="Server" />

Your codebehind should look something like this.
String strBeginDate = txtBeginDate.Text.Trim() + " " +
txtBeginTime.Text.Trim();
then you could say
DateTime FullBeginDate = DateTime DateTime.Parse(FullBeginDate); or
use a ParseExact variant, depending upon your needs.

Hope this helps to clear some stuff up and open some other avenues.

Nov 19 '05 #3
That is not really the standard method of doing what you are attempting
to accomplish. Your method is extremely backwards and requires going
through a bunch of unnecessary loops
Try this but once again this is NOT the preferred method of doing this.
You could actually combine this in shorter code but since it seems like
you are very new I am going to spell it out so that you can see all of
the steps being taken out. Before you can lean to walk you must first
learn to crawl.

Dim strBeginDate as String = Request.Form.GetValues("date")*(0)
Dim strBeginTime as String = Request.Form.GetValues("sTime")*(0)
Dim strTotalBegin as String = strBeginDate + strBeginTime
Dim beginDateas Date = DateTime.Parse(strTotalBegin)
writer.WriteLine("DTSTART:" &
beginDate.ToUniversalTime.ToSt*ring("yyyyMMdd\THHm mss\Z") )

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Magnus Lie Hetland | last post: by
2 posts views Thread by Brian | last post: by
3 posts views Thread by Unregistered | last post: by
2 posts views Thread by Confessor | last post: by
7 posts views Thread by odysseus654 | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.