VB   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Generating GUIDs with VB.NET大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

Takeaway: There are a variety of reasons why developers use globally unique identifiers (GUIDs),such as assigning unique identifiers to classes or when dealing with databases. This tip contains sample code that shows you how to generate GUIDs with VB.NET.

Developers use globally unique identifiers (GUIDs) for various reasons,such as assigning unique identifiers to classes or when dealing with databases. GUIDs are the Microsoft implementation of the diStributed compuTing environment (DCE) universally unique identifier (UUID). GUIDs are 128-bit globally unique identifiers that are automatically generated based on close to two zillion frequently varying factors.

There is an extremely low possibility that the value of GUID would be all zeroes,or that it would be equal to any other GUID. You can use GUIDs across all computers and networks wherever a unique identifier is required.

GUIDs identify objects such as interfaces and class objects. A GUID consists of one group of 8 hexadecimal digits,followed by three groups of 4 hexadecimal digits each,which are followed by one group of 12 hexadecimal digits.

In the following script,I manually generate the GUID that I can use later in the application by using VB.NET:

Private Sub GenerateGUID()

Dim sGUID As String
sGUID = System.Guid.NewGuid.ToString()
messageBox.Show(sGUID)

End Sub

In the example,I define a String variable,sGUID,to hold a GUID that I will generate. Then I set the value of sGUID to the value returned by the System.Guid.NewGuid method (using the System.Guid namespacE) and convert the result to a String using ToString(). The result is displayed in a message box.

Note: Visual studio .NET allows you to easily generate GUID interactively by running the Visual studio .NET Command Prompt. For more details,visit the MSDN site. Another resource to check out is the TechRepublic article,"Generating and working with GUIDs in .NET."

@H_55_46@miss a tip?

check out the Visual Basic archive,and catch up on the most recent editions of Irina Medvinskaya's column.

Advance your scripTing skills to the next level with TechRepublic's free Visual Basic newsletter,delivered each Friday. Automatically sign up today!

大佬总结

以上是大佬教程为你收集整理的Generating GUIDs with VB.NET全部内容,希望文章能够帮你解决Generating GUIDs with VB.NET所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。