I am sure this question has alot to do with my inexperience with VB...so its probably something simple.
I have a form with some text boxes on it. I have them set to be ReadOnly by default.
I want to make it so they can be enabled by opening a dialog box and typing a password.
So I created a public sub( ) that basically just enables the form fields when the correct password is typed. The problem is that the statement that makes ReadOnly=False seems to be ignored. In fact, even if I try to just show the value of one the textboxes in a messageBox it comes back blank. On the other hand if I make a private sub ( ) and put it on the same form page everything works as expected. So it seems that when I try to address the controls on that form from outside of the code for that form, it doesn't work. So for example if I put this code on my printReport_Form page, in a private sub it works:
me.price_tb.readOnly=False
BUT if I put this code in a Public Sub and put it either on the same code page or elsewhere it doesn't have any apparent effect and doesn't throw an error:
printReport_Form.price_tb.readOnly=False
I don't know if this makes any difference, but printReport_Form is initially opened from another page using this code:
Dim
myform As New printReport_Formmyform.ShowDialog()
Thanks for any help.

Public/Private Sub Issue
Jinnyminto
Thanks for the replies. I don't think I understand the answer though.
I actually do include the class name of the form that contains the controls when I try to turn off the readOnly property from another class, but that doesn't seem to matter.
In other words, form A contains a class called "Public Class printReport_Form"...and in that class I have a function that sets the text box called "price_tb" to readOnly=False.
me.price_tb.readOnly=True
Then I have another Form, in the code for that form, I address the text box as:
printReport_Form.price_tb.readOnly=False
Again, this doesn't throw any errors, but is ignored. I have also tried setting the .Text value from the other form and that is also ignored.
As far as controlsvisiblity () ... I am not sure how to use that function to help my situation. Can you tell me anything more about where I would put that When I try to use it, I get "not declared" errors.
EC
Kent McCroskey
"you can't access a class members from another class without intialize the class"
Perhaps this is a typo Shak and I did see the next sentence but this will work:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Class1.Hello()
End Sub
End Class
Public Class Class1
Public Shared Sub Hello()
End Sub
End Class
DR_CHAOS
hi, Reenec
i guess its my wierd english also i guess this will give him a exception if he added the textbox.readonly = true in shared method or property(something like can't access form control from shared method) i saw this ugly exception b4, so i proceed with the second solution to read the dialog property if the user if valid or not and depending on that he can determin the readonly property for his controls
Best regards
Ola Sprauten
hi,
really i'm confused would you send some code and plz prefix your code with the form name contains(controls name) and what this form do then you other form the same way
best regards
DPOMT
is this a web page
you can't access a class members from another class without intialize the class
you can acomplish that by making a public shared property controlsvisiblity () as boolean in your form so it will be visible to all your forms in your project without intialize a new instance of the form under you set statment put the you readonly code = value
you can also acomplish that by adding a property of public field to represent the user valid user or not if its valid user you read this property from your form for example
Dim myform As New printReport_Form ' this contain a valid user property
myform.ShowDialog()
if myform.validuser = true then
me.price_tb.readOnly=False
end if
hope this helps