6 Replies - 3608 Views - Last Post: 14 March 2009 - 08:54 AM Rate Topic: -----

#1 JohnorSky  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 137
  • Joined: 02-September 08

Converting simple vb6 to VB.NET please?

Post icon  Posted 10 March 2009 - 08:50 PM

I have 4 labels and a button on my form

Here is my code:


Private Sub Command1_Click()
	EmptyRecycleBin
	Form_Load
End Sub

Private Sub Form_Load()
Dim bin_size As Variant
Dim num_items As Variant
Dim kb As Single

	QueryRecycleBin , bin_size, num_items
	kb = bin_size / 1024
	lblSize.Caption = Format$(bin_size) & _
		" (" & Format(kb, "0.0") & " KB)"
	lblNumItems.Caption = Format$(num_items)
End Sub


This code is in vb6, I would like to make this code in VB.NET but I don't know how.. could anyone please TRANSLATE this code for me from vb6 into VB.NET?

basically what this code does it: "shows the size of the recycle bin", "shows the number of items in the recycle bin", and "deletes the items in the recycle bin"

Thank you for your help ;p

Is This A Good Question/Topic? 0
  • +

Replies To: Converting simple vb6 to VB.NET please?

#2 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Converting simple vb6 to VB.NET please?

Posted 10 March 2009 - 08:56 PM

You will have to use some API:

http://msdn.microsof...160(VS.85).aspx

http://msdn.microsof...241(VS.85).aspx
Was This Post Helpful? 0
  • +
  • -

#3 JohnorSky  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 137
  • Joined: 02-September 08

Re: Converting simple vb6 to VB.NET please?

Posted 10 March 2009 - 09:26 PM

I'm having a hard time understanding this.. :(
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Converting simple vb6 to VB.NET please?

Posted 11 March 2009 - 01:24 AM

Simply open the VB6 project in your VB .NET IDE and it will automatically convert it for you.
Was This Post Helpful? 0
  • +
  • -

#5 JohnorSky  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 137
  • Joined: 02-September 08

Re: Converting simple vb6 to VB.NET please?

Posted 11 March 2009 - 04:36 PM

View Postborn2c0de, on 11 Mar, 2009 - 12:24 AM, said:

Simply open the VB6 project in your VB .NET IDE and it will automatically convert it for you.


when i went to 'tools/upgrade visual basic 6 code' and put my code in it gave me this:
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
	Dim EmptyRecycleBin As Object
		EmptyRecycleBin()
		Form_Load()
	End Sub

	Private Sub Form_Load()
		Dim lblNumItems As Object
		Dim lblSize As Object
		Dim QueryRecycleBin As Object
		Dim bin_size As Object
		Dim num_items As Object
		Dim kb As Single

		QueryRecycleBin(, bin_size, num_items)
		'UPGRADE_WARNING: Couldn't resolve default property of object bin_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		kb = bin_size / 1024
		'UPGRADE_WARNING: Couldn't resolve default property of object lblSize.Caption. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object bin_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		lblSize.Caption = VB6.Format(bin_size) & " (" & VB6.Format(kb, "0.0") & " KB)"
		'UPGRADE_WARNING: Couldn't resolve default property of object lblNumItems.Caption. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object num_items. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		lblNumItems.Caption = VB6.Format(num_items)
	End Sub


is that what you meant?
Was This Post Helpful? 0
  • +
  • -

#6 CosmicTruth  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 08-March 09

Re: Converting simple vb6 to VB.NET please?

Posted 14 March 2009 - 08:39 AM

I had a VB 6 project that had a ".VBP" extention (visual basic project) I opened that using microsoft visual studio 2005 and it was automatic, the VB 6 project conversion wizard opened then I had to look at some settings (accepted the default) then the project was converted and opened in VB2005! wow it was converted almost perfect and ran perfect!

good luck with your conversion

Cosmic
Was This Post Helpful? 0
  • +
  • -

#7 jayfella  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 07-March 09

Re: Converting simple vb6 to VB.NET please?

Posted 14 March 2009 - 08:54 AM

Im from a VB6 background myself. If i were you, i would just get your head down and re-write it in .net - VB6 was good - but its waaaay to old now. vb.net is up-to-date and its worth investing your time learning it.

Its a lot easier in the long run. The converter never seemed to work for me in any intermediate situation.

This post has been edited by jayfella: 14 March 2009 - 08:54 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1