VB2005中字符串的空GUID [英] empty GUID from string in VB2005

查看:85
本文介绍了VB2005中字符串的空GUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




在VB2003中运行此代码时


Sub guidtest()


昏暗的字符串作为字符串


昏暗的gid作为Guid


gstring = Guid.NewGuid()。ToString


gid = New Guid(gstring)

End Sub


变量GID获取从gstring派生的正确值 - 但是当我在VB2005这个没有工作的这个
这个 - 我只是得到一个空GUID - 这看起来好像

a相当严重的问题所以我假设我做了一些不正确的基本

假设。


我的VS2005安装从内存开始非常流畅而且很漂亮

很多都有默认选项。


任何人都可以复制此问题/错误吗?


这是VS / VB或.NET中的错误吗?


我期待在这里听到有任何想法的人,因为我花了大约10个小时试图看看我做错了什么。


最好


Charles

Hi,

When running this code in VB2003

Sub guidtest()

Dim gstring As String

Dim gid As Guid

gstring = Guid.NewGuid().ToString

gid = New Guid(gstring)

End Sub

variable GID gets the correct value derived from gstring - however when i do
this in VB2005 it doesn''t work - i just get an empty GUID - this seems like
a fairly serious problem so i am assuming i have made some incorrect basic
assumptions.

my installation of VS2005 went pretty smoothly from memory and it pretty
much has default options.

Can anyone replicate this problem / error?

is it a bug in VS/VB or .NET?

I look forward to hearing from anyone with any ideas here as I have spent
about 10 hours trying to see what I have done wrong.

best

Charles

推荐答案

Charles,

抱歉,你的代码看起来很奇怪,可能就是你的意思。


\\\

dim gid as Guid = Guid.NewGuid

dim gstring = gid.ToString

///

尽量避免使用字符串作为中间字符,你会看到人们也这样做

with datetime。


我希望这会有所帮助,


Cor
Charles,

Sorry however your code looks so strange in my eyes, probably you mean.

\\\
dim gid as Guid = Guid.NewGuid
dim gstring = gid.ToString
///
Try to avoid using strings as intermediate, you see people do that as well
with datetime.

I hope this helps,

Cor





我在创建gid之后添加了这一行。


MessageBox.Show(gstring,gid.ToString)


我在标题和文字中得到相同的值。


Ken

-------

" Charles Hunt" <章***** @ HuntRAD.NET>在消息中写道

新闻:OO ************** @ TK2MSFTNGP10.phx.gbl ...
Hi,

I added this line after you created gid.

MessageBox.Show(gstring, gid.ToString)

I get the same value in the caption and text.

Ken
-------
"Charles Hunt" <Ch*****@HuntRAD.NET> wrote in message
news:OO**************@TK2MSFTNGP10.phx.gbl...

在VB2003中运行此代码时

Sub guidtest()

Dim gstring As String

Dim gid As Guid
gstring = Guid.NewGuid()。ToString

gid =新Guid(gstring)

结束子

变量GID得到从gstring派生的正确值 - 但是当我在VB2005中执行此操作时它不起作用 - 我只是得到一个空的GUID - 这看起来像
相当严重问题,所以我假设我已经做了一些不正确的基本
假设。

我的VS2005的安装从内存开始非常顺利,它非常有默认选项。

任何人都可以复制此问题/错误吗?

这是VS / VB或.NET中的错误吗?

我期待听到有任何想法的人的回复在这里,我花了大约10个小时试图看看我做错了什么。

Charles
Hi,

When running this code in VB2003

Sub guidtest()

Dim gstring As String

Dim gid As Guid

gstring = Guid.NewGuid().ToString

gid = New Guid(gstring)

End Sub

variable GID gets the correct value derived from gstring - however when i
do
this in VB2005 it doesn''t work - i just get an empty GUID - this seems
like
a fairly serious problem so i am assuming i have made some incorrect basic
assumptions.

my installation of VS2005 went pretty smoothly from memory and it pretty
much has default options.

Can anyone replicate this problem / error?

is it a bug in VS/VB or .NET?

I look forward to hearing from anyone with any ideas here as I have spent
about 10 hours trying to see what I have done wrong.

best

Charles






你使用的是哪个版本的VB?如果我使用VB2003它可以工作,如果我使用VB2005

它不起作用。


最好


Charles

Ken Tucker [MVP]" < VB *** @ bellsouth.net>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi,

Which version of VB did you use? If I use VB2003 it works, if I use VB2005
it doesn''t work.

best

Charles
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


我在创建gid之后添加了这一行。

MessageBox.Show(gstring,gid.ToString)

我得到相同的值标题和文字。

Ken
-------
Charles Hunt <章***** @ HuntRAD.NET>在消息中写道
新闻:OO ************** @ TK2MSFTNGP10.phx.gbl ...
Hi,

I added this line after you created gid.

MessageBox.Show(gstring, gid.ToString)

I get the same value in the caption and text.

Ken
-------
"Charles Hunt" <Ch*****@HuntRAD.NET> wrote in message
news:OO**************@TK2MSFTNGP10.phx.gbl...

在VB2003中运行此代码时

Sub guidtest()

Dim gstring As String

Dim gid As Guid
gstring = Guid.NewGuid()。ToString

gid =新Guid(gstring)


变量GID获取正确的值派生来自gstring - 但是当我在VB2005中做这个时它不起作用 - 我只是得到一个空GUID - 这似乎

一个相当严重的问题所以我是假设我做了一些不正确的基本
假设。

我的VS2005的安装从内存开始非常顺利,它非常有默认选项。

任何人都可以复制此问题/错误吗?

这是VS / VB或.NET中的错误吗?

我期待听到有任何想法的人的回复在这里,我花了大约10个小时试图看看我做错了什么。
<最好的

Charles
Hi,

When running this code in VB2003

Sub guidtest()

Dim gstring As String

Dim gid As Guid

gstring = Guid.NewGuid().ToString

gid = New Guid(gstring)

End Sub

variable GID gets the correct value derived from gstring - however when i
do
this in VB2005 it doesn''t work - i just get an empty GUID - this seems
like
a fairly serious problem so i am assuming i have made some incorrect
basic
assumptions.

my installation of VS2005 went pretty smoothly from memory and it pretty
much has default options.

Can anyone replicate this problem / error?

is it a bug in VS/VB or .NET?

I look forward to hearing from anyone with any ideas here as I have spent
about 10 hours trying to see what I have done wrong.

best

Charles




这篇关于VB2005中字符串的空GUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆