Sorry for the constant questions, I am very appreciative of the entire VB.Net Forum community's patience. As of a week ago, I had not even looked at vb.net and if it were vb6 I'd be able to do all of this on my own no problem!
As stated in other posts, I am making a Menu program. Currently I am working on skinning the menu. What I would like to do is have an array of menu items, each member in the array would have a label, up image, down image and over image. In vb6 I could use type.
Type Menu_Type
Dim Menu_Items(10) As Menu_Type
But I cannot do type, so I use
Public bmp_but_up As New Bitmap("c:\somebmp.bmp")
Public Class Menu_Type
Public Menu_Items(10) As Menu_Type
But when I try to assign a bitmap to menu_items(0).iUp
Menu_Items(0).iUp = bmp_but_up
I get the error "Object reference not set to an instance of an object."
If I understand correctly, I am trying to set an object as something that is not an object.
What should I research to help me understand how to make this work? I have loaded and scaled the image for each state of a button, no problem. But because I do not know what the text for each button will be until run time, I'd like to have each member of the menu list defined in an array, and the 3 states of the button stored with the text in menu_item(x).iText added to the image and have it assigned to that menu item.
So
Menu_Item(1).txt = "Menu Item 1"
and iup, idown, iover will be a correctly scaled image with the text "Menu Item 1" on each. This way, when it comes time to draw menu item 1, I do not have to go through the code of setting the image, adding the text and then draw the image, and when the state of the button changes have to do it all over again. I can just say
Private Sub picbox1.Mousemove(...)
Again, I thank everyone so much for taking time to help me. I hope that someday I can return the favor!
As stated in other posts, I am making a Menu program. Currently I am working on skinning the menu. What I would like to do is have an array of menu items, each member in the array would have a label, up image, down image and over image. In vb6 I could use type.
Type Menu_Type
Dim iText As String
Dim iUp As Image
Dim iDown As Image
Dim iOver As Image
End TypeDim iUp As Image
Dim iDown As Image
Dim iOver As Image
Dim Menu_Items(10) As Menu_Type
But I cannot do type, so I use
Public bmp_but_up As New Bitmap("c:\somebmp.bmp")
Public Class Menu_Type
Public iText as String
Public iUp as Bitmap
...
End ClassPublic iUp as Bitmap
...
Public Menu_Items(10) As Menu_Type
But when I try to assign a bitmap to menu_items(0).iUp
Menu_Items(0).iUp = bmp_but_up
I get the error "Object reference not set to an instance of an object."
If I understand correctly, I am trying to set an object as something that is not an object.
What should I research to help me understand how to make this work? I have loaded and scaled the image for each state of a button, no problem. But because I do not know what the text for each button will be until run time, I'd like to have each member of the menu list defined in an array, and the 3 states of the button stored with the text in menu_item(x).iText added to the image and have it assigned to that menu item.
So
Menu_Item(1).txt = "Menu Item 1"
and iup, idown, iover will be a correctly scaled image with the text "Menu Item 1" on each. This way, when it comes time to draw menu item 1, I do not have to go through the code of setting the image, adding the text and then draw the image, and when the state of the button changes have to do it all over again. I can just say
Private Sub picbox1.Mousemove(...)
picbox1.Image = Menu_Item(cur_item).iOver
End SubAgain, I thank everyone so much for taking time to help me. I hope that someday I can return the favor!