5 Replies - 1242 Views - Last Post: 28 November 2009 - 08:34 AM Rate Topic: -----

#1 SmoothCriminal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 09

Some part of vb6 code in VB.NET

Posted 27 November 2009 - 02:26 PM

this is the problem and i don't know how to change it so it does work
Public WithEvents cmdHold As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
	Public WithEvents imgCard As Microsoft.VisualBasic.Compatibility.VB6.PictureBoxArray
	Public WithEvents imgHeld As Microsoft.VisualBasic.Compatibility.VB6.PictureBoxArray


pls help

This post has been edited by SmoothCriminal: 27 November 2009 - 02:28 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Some part of vb6 code in VB.NET

#2 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Some part of vb6 code in VB.NET

Posted 27 November 2009 - 03:41 PM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

#3 SmoothCriminal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 09

Re: Some part of vb6 code in VB.NET

Posted 27 November 2009 - 04:27 PM

View PostSixOfEleven, on 27 Nov, 2009 - 02:41 PM, said:

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

type microsoft.VisualBasic.Compatibility.VB6.Buttonarray is not defined
type microsoft.VisualBasic.Compatibility.VB6.Pictureboxarray is not defined
that's the errors i have. But i'm working with the version of 2008 and i got this part from VB6 and some people say that the error i have is because it's not used in vb.net 2008 anymore. So i want to know waht i have to write and where so i can deal with it. it is some kind of array but with, for example btnVast(5), that doesn't work. sorry for bad english adn typmistakes. btw it's in de formdesignern so not teh main code
Was This Post Helpful? 0
  • +
  • -

#4 SmoothCriminal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 09

Re: Some part of vb6 code in VB.NET

Posted 27 November 2009 - 04:32 PM

This is the part of teh code which deals with the stuff (i will underline the things that don't work because of the error):
	Private Sub btnDeel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnDeel.Click
		txtStatus.Text = ""
		If Beurt = 1 Then
			Beurt = 2
			Voordeel = Voordeel - 1
			txtVoordeel.Text = CStr(Voordeel)
			Call shuffle()
			Call deal()
			For x = 1 To 5
				[b]btnVast(x)[/b].Enabled = True
			Next x
			Exit Sub
		End If
		If Beurt = 2 Then
			Beurt = 1
			Call deal()
			Call check()
			For x = 1 To 5
				[b]btnVast(x)[/b].Enabled = False
			Next x
			Exit Sub
		End If
	End Sub

	Sub shuffle()
		For x = 1 To 52
			gebruikteKaart(x) = ""
		Next x
		For x = 1 To 52
			Willekeurig = Int(Rnd() * 52) + 1
			boekKaart(x) = Kaart(Willekeurig)
			If gebruikteKaart(Willekeurig) <> "" Then
				x = x - 1
			Else
				gebruikteKaart(Willekeurig) = "True"
			End If
		Next x
	End Sub

	Sub deal()
		If Beurt = 1 Then
			spelendeKaart = 1
		Else
			spelendeKaart = 6
		End If
		For x = 1 To 5
			If Vast(x) = "" Then
				[b]imgKaart(x)[/b].Image = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "\kaarten\" & boekKaart(spelendeKaart) & ".gif")
				spelerKaart(x) = boekKaart(spelendeKaart)
				spelendeKaart = spelendeKaart + 1
			Else
			   [b] imgVast(x)[/b].Visible = False
				Vast(x) = ""
			End If
		Next x
	End Sub

	Private Sub btnVast_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnVast.Click
		Dim Index As Short = btnVast.GetIndex(eventSender)

		If Vast(Index) = "" Then
			Vast(Index) = "true"
			[b]imgVast(Index)[/b].Visible = True
		Else
			Vast(Index) = ""
			[b]imgVast(Index)[/b].Visible = False
		End If
	End Sub


and it seems like the bold tag doesnt work in code of vb... it's the following things: btnVast, imgVast and imgKaart. Like i said earlier, normally they must be in an array but it doesn't work because then i get "getindex" error etc.

This post has been edited by SmoothCriminal: 27 November 2009 - 04:35 PM

Was This Post Helpful? 0
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2240
  • View blog
  • Posts: 9,410
  • Joined: 29-May 08

Re: Some part of vb6 code in VB.NET

Posted 27 November 2009 - 04:51 PM

Try adding a project reference to the Microsoft.VisualBasic.Compatibilty.

Just using the conversion tool is going to auto-magic-ally give you the advantage of using .net
Think of it as training wheels. My opinion it should never have had them in the first place, it a different language.

If you are converting an old vb6 project to vb.net, its an opportunity to sit down and understand the code the you converting.
You may find way to improve it, simplify it. etc
Was This Post Helpful? 0
  • +
  • -

#6 SmoothCriminal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-November 09

Re: Some part of vb6 code in VB.NET

Posted 28 November 2009 - 08:34 AM

View PostAdamSpeight2008, on 27 Nov, 2009 - 03:51 PM, said:

Try adding a project reference to the Microsoft.VisualBasic.Compatibilty.

And how can i do that? or how can i insert a withevent IN de main code?
I'm very new to vb.net, only now the basics so if you can explain as much as you can in detail, that will be gr8! ty in advance
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1