Assigning value in Form2 from Form1 thorws error. why?
Hi all,
I have two forms, Form1 and Form2 respectively. I have a command button in form1. I do some manipulations and finally I display the results in form2 using the following code:
VB Code:
With Form2
.lblResult = "This is a test result line 1" & vbcrlf & "This is a test result line 2" 'display the output in label.
.show vbModal
end with
If I run this code I got "Error no. 78; File/Path access error".
Anybody know what sort of error it is? and How can I avoid this?
CS.
Re: Assigning value in Form2 from Form1 thorws error. why?
What do you have in Form2 Load event?
Re: Assigning value in Form2 from Form1 thorws error. why?
cssriraman, using your code, and nothing else, I get the text showing on Form2 with no error.
Open a new project with 2 forms, a button on 1 and a label on the other, and it'll probably work.
Re: Assigning value in Form2 from Form1 thorws error. why?
Thanks!
@Al42 & RhinoBull:
I used the same thing in many projects and never had any issue.
You know what, I declared a public variable in Form2:
VB Code:
public strTemp as string
Private Sub Form_Load()
lblResult.Caption=strTemp
End Sub
And in Form1
VB Code:
With Form2
.strTemp = "This is a test result line 1" & vbcrlf & "This is a test result line 2" 'display the output in label.
.show vbModal
end with
This code worked fine without any issues.
Not sure what is the root cause for Path/file access error.
Is the Form2/form1 is corrupted or something? But I can open it, see/edit the code and can complie it.
Re: Assigning value in Form2 from Form1 thorws error. why?
This happens to my current project only not on all projects.
Re: Assigning value in Form2 from Form1 thorws error. why?
Open the form files in Notepad and see if there's anything in there that shouldn't be. (Open a good form file in Notepad and compare, if you aren't familiar with what the file should look like.)