473,387 Members | 1,721 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,387 software developers and data experts.

Can You Convert This VB Snippet?

This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke
on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub
--
<%= Clinton Gallagher
Nov 16 '05 #1
6 1419
private void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs
e){
Profile.GetProfile(e.AnoynmousId);
if(anoynmousProfile.Cart != null){
Profile.Cart == anonymoustProfile.Cart;
}
}

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub
--
<%= Clinton Gallagher

Nov 16 '05 #2
On 2004-11-25, clintonG <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote:
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke
on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub


void Profile_MigrateAnonymous (object sender, ProfileMigrateEventArgs e)
{
ASP.HttpProfile anonymousProfile =
Profile.GetProfile (e.AnonymousId);

if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}

HTH
--
Tom Shelton [MVP]
Nov 16 '05 #3
Ooops, I forogt one line:
Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

===
ASP.HttpProfile anonymousProfile = Profile.GetProfile(e.AnoynmousId);

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub
--
<%= Clinton Gallagher

Nov 16 '05 #4
Thank you. That's what I tried but I'm still getting mismatched brace
exceptions on the first brace of the Application_Start code block when the
converted code is used in the global.asax as follows...

void Application_Start(Object sender, EventArgs e)
{
void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e)
{
ASP.HttpProfile anonymousProfile = Profile.GetProfile
(e.AnonymousId);
if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}
}

It seems to be the presence of the Profile_MigrateAnonymous code block. I've
commented that code block out while leaving the statements within the
Profile_MigrateAnonymous code block uncommented and vice-versa. When the
Profile_MigrateAnonymous code block (and its braces) are commented the
squiggly underlined Application_Start code block brace mismatch dissappears.

<%= Clinton Gallagher


"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
On 2004-11-25, clintonG <cs*********@REMOVETHISTEXTmetromilwaukee.com>

wrote:
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub


void Profile_MigrateAnonymous (object sender, ProfileMigrateEventArgs e)
{
ASP.HttpProfile anonymousProfile =
Profile.GetProfile (e.AnonymousId);

if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}

HTH
--
Tom Shelton [MVP]

Nov 16 '05 #5
Thank you. Please see my response above...

<%= Clinton Gallagher

"W.G. Ryan eMVP" <Wi*********@NoSpam.gmail.com> wrote in message
news:uB**************@TK2MSFTNGP15.phx.gbl...
Ooops, I forogt one line:
Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

===
ASP.HttpProfile anonymousProfile = Profile.GetProfile(e.AnoynmousId);

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters

choke
on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub
--
<%= Clinton Gallagher


Nov 16 '05 #6
Clinton...
You are declaring a method within a method. Of course the compiler is
complaining.
Declare your method seperately... then call it from within Application_Start

--- Nick

void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs
e)
{
ASP.HttpProfile anonymousProfile = Profile.GetProfile
(e.AnonymousId);
if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}

void Application_Start(Object sender, EventArgs e)
{
Profile_MigrateAnonymous(sender, e);
}

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:OR**************@TK2MSFTNGP14.phx.gbl...
Thank you. That's what I tried but I'm still getting mismatched brace
exceptions on the first brace of the Application_Start code block when the
converted code is used in the global.asax as follows...

void Application_Start(Object sender, EventArgs e)
{
void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e) {
ASP.HttpProfile anonymousProfile = Profile.GetProfile
(e.AnonymousId);
if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}
}

It seems to be the presence of the Profile_MigrateAnonymous code block. I've commented that code block out while leaving the statements within the
Profile_MigrateAnonymous code block uncommented and vice-versa. When the
Profile_MigrateAnonymous code block (and its braces) are commented the
squiggly underlined Application_Start code block brace mismatch dissappears.
<%= Clinton Gallagher


"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
On 2004-11-25, clintonG <cs*********@REMOVETHISTEXTmetromilwaukee.com>

wrote:
This code has to go into the global.asax Application_Start code block.
I'm just not getting this one right and the web-based code converters choke on it. Can somebody rewrite this VB snippet to C# for me?

Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)

Dim anonymousProfile As ASP.HttpProfile =
Profile.GetProfile(e.AnonymousId)

If anonymousProfile.Cart IsNot Nothing Then
Profile.Cart = anonymousProfile.Cart
End If

End Sub


void Profile_MigrateAnonymous (object sender, ProfileMigrateEventArgs e)
{
ASP.HttpProfile anonymousProfile =
Profile.GetProfile (e.AnonymousId);

if (anonymousProfile.Cart != null)
{
Profile.Cart = anonymousProfile.Cart;
}
}

HTH
--
Tom Shelton [MVP]


Nov 16 '05 #7

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

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Fritz Switzer | last post by:
With two controls a PictureBox and another "PictureBox like" , Pic2, a control from a dll, I'm stuck on cannot implicity convert System.Drawing.Image to System.Drawing.Bitmap error. How do I...
8
by: Prakash | last post by:
Hi Friends, Using Remoting concept, i have send WCHAR values from VC++.net applicaiton to C# applicaiton. In my C# application it is treated as unsigned shot. I need to convert it back to string...
3
by: XML newbie: Urgent pls help! | last post by:
Does anyone have a snippet of code that will convert a string array to a long array? I've nearly smashed my head against the wall trying to figure this out. I'm Using vb.net 2005 Pls reply...
23
by: comp.lang.tcl | last post by:
I have a TCL proc that needs to convert what might be a list into a string to read consider this: ]; # OUTPUTS Hello World which is fine for PHP ]; # OUTPUT {{-Hello}} World, which PHP...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
5
by: nil | last post by:
hello everyone can any one tell me how can i convert my grid data in to pdf?pls provide some code snippet or some link that contains the related topic.. Thanks & Regards, Nil
4
by: tshad | last post by:
I am trying to convert a string character to an int where the string is all numbers. I tried: int test; string stemp = "5"; test = Convert.ToInt32(stemp); But test is equal to 53.
9
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.