Results 1 to 6 of 6

Thread: Assigning value in Form2 from Form1 thorws error. why?

  1. #1

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    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:
    1. With Form2
    2.     .lblResult = "This is a test result line 1" & vbcrlf & "This is a test result line 2" 'display the output in label.
    3.     .show vbModal
    4. 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.
    CS

  2. #2

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  4. #4

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    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:
    1. public strTemp as string
    2. Private Sub Form_Load()
    3. lblResult.Caption=strTemp
    4. End Sub
    And in Form1
    VB Code:
    1. With Form2
    2.     .strTemp = "This is a test result line 1" & vbcrlf & "This is a test result line 2" 'display the output in label.
    3.     .show vbModal
    4. 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.
    CS

  5. #5

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Assigning value in Form2 from Form1 thorws error. why?

    This happens to my current project only not on all projects.
    CS

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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.)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width