473,405 Members | 2,210 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,405 software developers and data experts.

Covert string to System.Guid, how??

ASP.NET 2.0

I'm wondering how to convert a string into a System.Guid!

I have this code where I want to use the convert:
Message.DeleteMessage(hidden.Value);. Here DeleteMessage wants an argument
of type System.Guid, but the hidden.Value (HiddenField) has stored it as a
string. I need to convert the value of hidden.Value to a System.Guid for
this to compile, but how??

Any suggestions?`

Jeff
Apr 16 '07 #1
2 11999

try

System.Guid g = new Guid("f72941f4-57fa-46db-89ba-df4a17277b05");

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Jeff" wrote:
ASP.NET 2.0

I'm wondering how to convert a string into a System.Guid!

I have this code where I want to use the convert:
Message.DeleteMessage(hidden.Value);. Here DeleteMessage wants an argument
of type System.Guid, but the hidden.Value (HiddenField) has stored it as a
string. I need to convert the value of hidden.Value to a System.Guid for
this to compile, but how??

Any suggestions?`

Jeff
Apr 16 '07 #2
Jeff wrote:
ASP.NET 2.0

I'm wondering how to convert a string into a System.Guid!

I have this code where I want to use the convert:
Message.DeleteMessage(hidden.Value);. Here DeleteMessage wants an argument
of type System.Guid, but the hidden.Value (HiddenField) has stored it as a
string. I need to convert the value of hidden.Value to a System.Guid for
this to compile, but how??

Any suggestions?`

Jeff
Have you tried:

new Guid(hidden.Value)

--
Göran Andersson
_____
http://www.guffa.com
Apr 16 '07 #3

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

Similar topics

6
by: Yog | last post by:
How do i convert a string to a Guid datatype
1
by: Sandra | last post by:
I am trying to convert a string into a uniqueidentifier by using the following code string contrID = Request.Params["oId" SqlGuid sqlID = SqlGuid.Parse(contrID I am then putting sqlID into my...
1
by: Jeffrey B. Holtz | last post by:
I'm trying to get the Name of the USB device pluged in from the RegisterDeviceNotification that I've used P/Invoke to marshal. I have seen a similar posting on the VisualBasic newgroups but I do...
10
by: Crirus | last post by:
Is there a function that return some random ID like string alphanumeric? Like this: A35sDsd1dSGsH Thanks Crirus
7
by: Desmond Cassidy | last post by:
Hi, I have being trying to get a grip of HTML data manipulation and am using the mshtml class and System.Net to retriver HTML pages. Now as far as I can see, one can read HTML in different ways....
10
by: Charles Hunt | last post by:
Hi, When running this code in VB2003 Sub guidtest() Dim gstring As String Dim gid As Guid
6
by: Calros Lo | last post by:
Dear all: I develop a programe that need when I get a string , such as "123" or "ABC",if I get string "123" and the system will help me to create new string "124" , if I get string "ABC" and the...
2
by: Jeff | last post by:
ASP.NET 2.0 I have a GridView on my webpage. As one of its columns I've put a HiddenField into a TemplateField. The porpose of this HiddenField is to hold the ID of the row. Each row in the...
5
by: Anders Borum | last post by:
Hi! While implementing a property manager (that supports key / value pairs), I was wondering how to constrain T to a struct or string type. Basically, I guess what I'm looking for is the common...
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
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...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.