Question change on the button?

Firstly, if you're going to provide a download then I would suggest using ZIP rather than RAR format. You exclude a lot of people by using RAR. Secondly, expecting others to download, extract, open, search and run your project should be the last resort. Your first option should be to make as much effort as you can to save us having to make more effort than is necessary. That means you providing a FULL and CLEAR description of the problem rather than expecting us to work it out for ourselves. That would include an explanation of what you're trying to achieve, an explanation of how you're trying to achieve it (including RELEVANT code posted DIRECTLY rather than all your code as a separate download) and an explanation of what actually happens when you try (including all error messages and specific indication of where they occur and a description of how reality differs from expectation). That way we have everything we need right here and, if ten people view this thread, we can all see all the relevant information rather than all of us having to separately work out what you already know. If we need more information then we'll ask for it.
 
You can help me

please

I do not know what I do wrong
please help

her is a example

1.JPG

1a.JPG

2.JPG

2a.JPG

2b.JPG

3.JPG


why code does not work

Sub ZazeniP()

' Here I want to make a change on the button


Meni.Button1.Text = "Besedilo"
Meni.Button1.Location = New System.Drawing.Size(0, 0)
Meni.Button1.Size = New System.Drawing.Size(147, 71)

End Sub

please help
 
I believe that you are having an issue with scoping... First of all, you have a variable with the same name as the name of a class (albeit the class is in a different namespace):
VB.NET:
Dim [B]meni [/B]As New Okno1.[B]Meni[/B]

When you do this, it makes it more difficult to sort out the different scope of objects. I've even gotten into the habit of naming parameters of subs and functions differently than the name of the variable being passed to the sub/function just so I can ensure that I'm scoping it correctly. So for example I might write:
VB.NET:
Public Sub SaveInDatabase(ByVal strSN As String)
If strSN.Length>5 then
     ... ' Code to store the Serial Number into the Database
Else
     ... ' Serial Number not correct length. Report to user.
     MsgBox("Error")
End If
End Sub
...
Dim strSerialNumber As String = "ABC123"
SaveInDatabase(strSerialNumber)

So in your own code, when the ZazeniP Sub is trying to change the Meni form, it is only accessing the class itself instead of a particular instance of that form. The variable "meni" that you created in Start is different from the "Meni" that you're trying to change in ZazeniP. Furthermore, you are trying to change properties of an object that hasn't completely loaded yet... A better way would be to have your ZazeniP Sub require a Form (or even better, a Meni object) that would then be referenced in ZazeniP as the specific instance of the Meni object that you want to change. So your code might look something more like:
VB.NET:
Public Class Start
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objMyMeni As New Meni ' This Loads a new instance of the Meni form
        Dim objMyNazivG As New NazivG ' This creates an instance of the NazivG object/class
        objMyNazivG.ZazeniP(objMyMeni) ' This calls the ZazeniP Sub to change Button1 on the instance of the Meni form that I pass in as a parameter for that Sub
        objMyMeni.Show() ' Finally I Show the instance of the Meni form, complete with its changes
    End Sub

    Private Sub Start_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
End Class

... ' And in a different Form Class that I added to the project:

Public Class Meni
    Private Sub Meni_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
' No code in here. All of the code has been moved to the Start's Button1_Click event handler.
    End Sub
End Class

Public Class NazivG
    Public Sub ZazeniP(ByVal objForm As Meni)
        objForm.Button1.Text = "Besedilo"
    End Sub
End Class

As you see, I pulled the code out of the Meni_Load event so that the form could first load. And then I changed the specific instance of the Meni form (ie objMyMeni) by passing it to the ZazeniP Sub.
 
Back
Top