hallo zusammen hab mal wieder eine frage und diesmal nicht aus dem untericht und darum auch mit visual studio !!yeah!!
und zwar versuche ich gerade einer picturebox zu sagen welches bild es anzeigen soll. ich habe nun bereits die zweite variante ausprobiert aber auch die geht nicht. hier mal der code für v2:
und bei v1 war bildpfad as string deklariert und jeder link hat ein tostring dranbekommen. auch das hat net funktioniert wie kriege ich das hin, das ich dem programm sagen kann welches bild er anzeigen soll??
mal wieder besten dank im voraus
mfg ICE
edit: hier noch die fehlermeldung: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
und zwar versuche ich gerade einer picturebox zu sagen welches bild es anzeigen soll. ich habe nun bereits die zweite variante ausprobiert aber auch die geht nicht. hier mal der code für v2:
VB.NET-Quellcode
- Public Class Form1
- Public BildPfad() As Image
- Public Kartenwert() As Byte
- Public zufallszahl As Integer
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- BildPfad(0) = My.Resources.Deckblatt
- BildPfad(1) = My.Resources.karo2c_152
- BildPfad(2) = My.Resources.karo3c_152
- BildPfad(3) = My.Resources.karo4c_152
- BildPfad(4) = My.Resources.karo5c_152
- BildPfad(5) = My.Resources.karo6c_152
- BildPfad(6) = My.Resources.karo7c_152
- BildPfad(7) = My.Resources.karo8c_152
- BildPfad(8) = My.Resources.karo9c_152
- BildPfad(9) = My.Resources.karo10c_152
- BildPfad(10) = My.Resources.karobubec_152
- BildPfad(11) = My.Resources.karodamec_152
- BildPfad(12) = My.Resources.karokoenigc_152
- BildPfad(13) = My.Resources.karoasc_152
- BildPfad(14) = My.Resources.herz2c_152
- BildPfad(15) = My.Resources.herz3c_152
- BildPfad(16) = My.Resources.herz4c_152
- BildPfad(17) = My.Resources.herz5c_152
- BildPfad(18) = My.Resources.herz6c_152
- BildPfad(19) = My.Resources.herz7c_152
- BildPfad(20) = My.Resources.herz8c_152
- BildPfad(21) = My.Resources.herz9c_152
- BildPfad(22) = My.Resources.herz10c_152
- BildPfad(23) = My.Resources.herzbubec_152
- BildPfad(24) = My.Resources.herzdamec_152
- BildPfad(25) = My.Resources.herzkoenigc_152
- BildPfad(26) = My.Resources.herzasc_152
- BildPfad(27) = My.Resources.pik2c_152
- BildPfad(28) = My.Resources.pik3c_152
- BildPfad(29) = My.Resources.pik4c_152
- BildPfad(30) = My.Resources.pik5c_152
- BildPfad(31) = My.Resources.pik6c_152
- BildPfad(32) = My.Resources.pik7c_152
- BildPfad(33) = My.Resources.pik8c_152
- BildPfad(34) = My.Resources.pik9c_152
- BildPfad(35) = My.Resources.pik10c_152
- BildPfad(36) = My.Resources.pikbubec_152
- BildPfad(37) = My.Resources.pikdamec_152
- BildPfad(38) = My.Resources.pikkoenigc_152
- BildPfad(39) = My.Resources.pikasc_152
- BildPfad(40) = My.Resources.kreuz2c_152
- BildPfad(41) = My.Resources.kreuz3c_152
- BildPfad(42) = My.Resources.kreuz4c_152
- BildPfad(43) = My.Resources.kreuz5c_152
- BildPfad(44) = My.Resources.kreuz6c_152
- BildPfad(45) = My.Resources.kreuz7c_152
- BildPfad(46) = My.Resources.kreuz8c_152
- BildPfad(47) = My.Resources.kreuz9c_152
- BildPfad(48) = My.Resources.kreuz10c_152
- BildPfad(49) = My.Resources.kreuzbubec_152
- BildPfad(50) = My.Resources.kreuzdamec_152
- BildPfad(51) = My.Resources.kreuzkoenigc_152
- BildPfad(52) = My.Resources.kreuzasc_152
- Kartenwert(0) = 0
- Kartenwert(1) = 2
- Kartenwert(2) = 3
- Kartenwert(3) = 4
- Kartenwert(4) = 5
- Kartenwert(5) = 6
- Kartenwert(6) = 7
- Kartenwert(7) = 8
- Kartenwert(8) = 9
- Kartenwert(9) = 10
- Kartenwert(10) = 2
- Kartenwert(11) = 3
- Kartenwert(12) = 4
- Kartenwert(13) = 11
- Kartenwert(14) = 2
- Kartenwert(15) = 3
- Kartenwert(16) = 4
- Kartenwert(17) = 5
- Kartenwert(18) = 6
- Kartenwert(19) = 7
- Kartenwert(20) = 8
- Kartenwert(21) = 9
- Kartenwert(22) = 10
- Kartenwert(23) = 2
- Kartenwert(24) = 3
- Kartenwert(25) = 4
- Kartenwert(26) = 11
- Kartenwert(27) = 2
- Kartenwert(28) = 3
- Kartenwert(29) = 4
- Kartenwert(30) = 5
- Kartenwert(31) = 6
- Kartenwert(32) = 7
- Kartenwert(33) = 8
- Kartenwert(34) = 9
- Kartenwert(35) = 10
- Kartenwert(36) = 2
- Kartenwert(37) = 3
- Kartenwert(38) = 4
- Kartenwert(39) = 11
- Kartenwert(40) = 2
- Kartenwert(41) = 3
- Kartenwert(42) = 4
- Kartenwert(43) = 5
- Kartenwert(44) = 6
- Kartenwert(45) = 7
- Kartenwert(46) = 8
- Kartenwert(47) = 9
- Kartenwert(48) = 10
- Kartenwert(49) = 2
- Kartenwert(50) = 3
- Kartenwert(51) = 4
- Kartenwert(52) = 11
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- zufallszahl = CInt(NumericUpDown1.Value)
- Label2.Text = Kartenwert(zufallszahl)
- PictureBox1.Image = BildPfad(zufallszahl)
- End Sub
- End Class
und bei v1 war bildpfad as string deklariert und jeder link hat ein tostring dranbekommen. auch das hat net funktioniert wie kriege ich das hin, das ich dem programm sagen kann welches bild er anzeigen soll??
mal wieder besten dank im voraus
mfg ICE
edit: hier noch die fehlermeldung: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „ICEMAN-Wappen“ ()