473,698 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining 2 variables

Brand new to .aspx, and just modifying code.

I have this:
writer.WriteLin e("DTSTART:" &
beginDate.ToUni versalTime.ToSt ring("yyyyMMdd\ THHmmss\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.Ge tValues("date") (0)
Dim beginTime as StartTime = Request.Form.Ge tValues("StartT ime")(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 2392
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="txtBeginDat e" runat="Server" />
<asp:TextBox Id="txtBeginTim e" runat="Server" />

Your codebehind should look something like this.
String strBeginDate = txtBeginDate.Te xt.Trim() + " " +
txtBeginTime.Te xt.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.Ge tValues("date") (0)
Dim beginTime as Date = Request.Form.Ge tValues("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.WriteLin e("DTSTART:" &
beginDate.ToUni versalTime.ToSt ring("yyyyMMdd\ THHmmss\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****@communi ty.nospam" <ma**********@g mail.com> wrote in message
news:11******** *************@l 41g2000cwc.goog legroups.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="txtBeginDat e" runat="Server" />
<asp:TextBox Id="txtBeginTim e" runat="Server" />

Your codebehind should look something like this.
String strBeginDate = txtBeginDate.Te xt.Trim() + " " +
txtBeginTime.Te xt.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.Ge tValues("date") *(0)
Dim strBeginTime as String = Request.Form.Ge tValues("sTime" )*(0)
Dim strTotalBegin as String = strBeginDate + strBeginTime
Dim beginDateas Date = DateTime.Parse( strTotalBegin)
writer.WriteLin e("DTSTART:" &
beginDate.ToUni versalTime.ToSt *ring("yyyyMMdd \THHmmss\Z") )

Nov 19 '05 #4

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

Similar topics

3
2331
by: Magnus Lie Hetland | last post by:
If I want to specify both mode and source encoding using the -*- FOO -*- syntax in emacs -- how can I do that? Both insist on being on the second line of the file, yet I have found no way of combining them. That is, the following doesn't work properly (not in all emaxen, at least): #!/usr/bin/env python
2
2741
by: Brian | last post by:
Hi All, Can someone please point me in the right direction I am having problems combining JS and ASP. What I am trying to do is store in a database using ASP the referring page of my visitors. I got the ASP working great and when I use the document.referrer in an alert it works too, but when I try to combine the 2 languages that is when I get an error that I cannot fix. Here is the code fragment that is not working: rs("ReferPage")...
3
1470
by: Unregistered | last post by:
Hello! I came across two different scripts that I wanted to combine, and I thought I wa successful until I discovered a minor glitch. What was happening was that the page that was linked to came out fine but the page where the link was was linking out to another page . Here's what my code looks like.
2
1047
by: Confessor | last post by:
I have two *very* similar groups of related procedures in my program, and I'd like to try combining them, but I'm running into one big problem. Private Sub TileSearchCluster(ByVal PossibleClusterTile1 As HexicTile, ByVal PossibleClusterTile2 As HexicTile, ByVal PossibleClusterTile3 As HexicTile) If Equals(PossibleClusterTile1.Color, PossibleClusterTile2.Color) Then If Equals(PossibleClusterTile1.Color, PossibleClusterTile3.Color) Then...
7
1538
by: odysseus654 | last post by:
I have just discovered the "with" statement, which up until now I have only known as "that which should never be used". I would like to evaluate some commands (such as function definitions and the like) within the global context, would this accomplish the task? Are there better ways to deal with this? (Note that I am making dynamic execution a requirement) function executeAsGlobal(cmd) { with(window) exec(cmd);
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8862
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...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
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.