5 Replies - 1323 Views - Last Post: 26 June 2009 - 11:47 AM Rate Topic: -----

#1 eraldo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 23-June 09

Vb6 to VB.net

Posted 25 June 2009 - 09:36 AM

Private Sub Command1_Click()
   Text1 = GenerateCode()
End Sub

Public Function GenerateCode()
   strInputString = "1234567890abcdefghijklmnopqrstuvwxyz"
   
   intLength = Len(strInputString)
   
   intNameLength = 15
   
   Randomize
   
   strName = ""
   
   For intStep = 1 To intNameLength
	   intRnd = Int((intLength * Rnd) + 1)
   
	   strName = strName & Mid(strInputString, intRnd, 1)
   Next
   
   GenerateCode = strName
End Function



I coded this a few years ago in vb6, iv been using vb.net and got used to it now and i cannt figure out how to code this into vb.net using visual basic 2008 express edition.

Iv tried recoding it but im getting so many errors, iv also tried a vb6 to vb.net converter which created a lot more errors.

This post has been edited by eraldo: 25 June 2009 - 09:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Vb6 to VB.net

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 463
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Vb6 to VB.net

Posted 25 June 2009 - 11:33 AM

oh yes no chance to copy past it :) but if you tell us the errors may be we can help you
Was This Post Helpful? 0
  • +
  • -

#3 eraldo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 23-June 09

Re: Vb6 to VB.net

Posted 25 June 2009 - 12:14 PM

Never mind iv successfully recoded it to work in vb 2008

thanks for the response tho.
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Vb6 to VB.net

Posted 25 June 2009 - 10:58 PM

Can we see your result? There are people out there that may have the same problem and it would be of major interest to show how you have done it.
Was This Post Helpful? 0
  • +
  • -

#5 Rhymer  Icon User is offline

  • D.I.C Regular

Reputation: 23
  • View blog
  • Posts: 282
  • Joined: 21-April 09

Re: Vb6 to VB.net

Posted 26 June 2009 - 11:16 AM

Could you describe some of the errors you got using VB.Net? I personally have not used .net and this subroutine isn't that difficult to understand which is why maybe you forgot how it worked and just had to start all over from scratch. Doesn't look like much out of the ordinary coding calls though, maybe Randomize (has perennially been a problem). Is converting to VB.net that much different?
Was This Post Helpful? 0
  • +
  • -

#6 Ghostwolf  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 23
  • Joined: 01-May 09

Re: Vb6 to VB.net

Posted 26 June 2009 - 11:47 AM

It looks like there's a bit of a difference!

I just let .NET convert a working VB6 program. A simple definition, (inside a Structure),
cPSID as String *1

made it through the converter as
<VBFixedString(1),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=1)> Public cPSID() as Char


And now I've got to figure out how to replace all the Printer.Print code in there, too.

And this is better?!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1