By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,555 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,555 IT Pros & Developers. It's quick & easy.

Replacement for StrPtr ?

P: n/a
Tim
I've searched my help files, and all I can find is that the StrPtr() function is
not supported.

Is there a suitable replacement in VB.Net?
Nov 20 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Tim wrote:
I've searched my help files, and all I can find is that the StrPtr()
function is not supported.

Is there a suitable replacement in VB.Net?


What do you need it for? If you let us know, we can point you to the
correct method to do what it is you need to do....

Tom Shelton
Nov 20 '05 #2

P: n/a
Tim,

Take a look at Marshal.PtrToStringAuto , Marshal.PtrToStringAnsi,
and Marshal.PtrToStringUni.
http://msdn.microsoft.com/library/de...mberstopic.asp

Ken
---------------------
"Tim" <ti*****@hotmail.com> wrote in message
news:eo*************@TK2MSFTNGP09.phx.gbl...
I've searched my help files, and all I can find is that the StrPtr() function is not supported.

Is there a suitable replacement in VB.Net?

Nov 20 '05 #3

P: n/a
Cor
Hi Tim,

You can doubt if this is a subject for this newsgroup. On the other hand I'
ve seen an answer from Herfried to Ashok where Herfried did write.
Please post the complete VB6 declaration of 'EbExecuteLine'. Why do you

use this function?!
So maybe he can help you when you send that.

Did you know there is a special newsgroup for dotnet vb upgrade questions?
(I thought Herfried was active in that newsgroup too).
Maybe you can get a quicker answer there.

Mostly Herfried looks for the messages about 11:00 or 12:00 GMT, but it is
Sunday in Europe so I don't know if that will be today.

I hope you get your answer.

Cor


Nov 20 '05 #4

P: n/a
Cor
Hi Tim,
I was writing this while you got your answers.
Happenly a lot faster and better than yesterday.
Cor
Nov 20 '05 #5

P: n/a
Hello,

"Cor" <no*@non.com> schrieb:
You can doubt if this is a subject for this newsgroup.
I think it is...
Mostly Herfried looks for the messages about 11:00 or 12:00
GMT, but it is Sunday in Europe so I don't know if that will be
today.


;-)

I hope Tim posts the code he wants to convert.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #6

P: n/a
Hello,

"Tim" <ti*****@hotmail.com> schrieb:
Well it's just a small program I've written in VB6 for my work.
I know I could take my time and create a REAL one, but
I've been using an InputBox() to get a response from someone,
and I was using the StrPtr() method to detect if the user
was pressing Cancel rather than pressing Enter


That's not supported by the VB.NET 'InputBox' any more.

You may want to implement an input box on your own:

http://groups.google.de/groups?selm=...TNGP12.phx.gbl

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #7

P: n/a
I have the same issue to resolve. Here is relevant code that requires modification:

lngResult = CoCreateGuid(udtGUID) ' Create a 'raw' GUID
If lngResult = GUID_OK Then
strFormattedGUID = New String(Chr(0), GUID_LENGTH + 1)
' Convert the 'raw' GUID to a formatted string
'UPGRADE_ISSUE: StrPtr function is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"'
StringFromGUID2(udtGUID, StrPtr(strFormattedGUID), GUID_LENGTH + 1)
Else ' Either return nothing or find some way to handle the error
strFormattedGUID = Right(Space(GUID_LENGTH) & VB6.Format(Now, "yyyymmddhhnn") & VB6.Format(GetTickCount(), "000000000000"), GUID_LENGTH)
End If
CreateGUIDKey = Left(Trim(strFormattedGUID) & Space(GUID_LENGTH), GUID_LENGTH)

Brenton
From http://www.developmentnow.com/g/38_2...or-StrPtr-.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Mar 16 '07 #8

P: n/a
"Brenton Norman" <br************@medcom.com.auschrieb:
lngResult = CoCreateGuid(udtGUID) ' Create a 'raw' GUID
If lngResult = GUID_OK Then
strFormattedGUID = New String(Chr(0), GUID_LENGTH + 1)
' Convert the 'raw' GUID to a formatted string
'UPGRADE_ISSUE: StrPtr function is not supported. Click for
more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"'
StringFromGUID2(udtGUID, StrPtr(strFormattedGUID), GUID_LENGTH
+ 1)
How does the declaration of 'StringFromGUID2' look like?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 16 '07 #9

P: n/a
Addendum:

In addition, take a look at the 'System.Guid' class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Mar 16 '07 #10

P: n/a
Hear's the StringFromGUID2 declration:

Private Declare Function StringFromGUID2 Lib "OLE32.DLL" (ByRef pGuid As GUID, ByVal PointerToString As Integer, ByVal MaxLength As Integer) As Integer

Brenton

From http://www.developmentnow.com/groups...hreadid=226413

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Mar 19 '07 #11

P: n/a
I think this does the job:

Dim udtGUID As System.Guid
Dim strFormattedGUID As String

udtGUID = System.Guid.NewGuid()
...
strFormattedGUID = udtGUID.ToString

Brenton
From http://www.developmentnow.com/groups...hreadid=226413

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Mar 20 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.