• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

Accessing a form added to a project - easy points!

I know this is brain dead but I have vapor lock and for some reason cannot figure this out.

I have an existing project to which I added a form (Project->Add Windows Form->Windows Form)
I added controls and code to the that form and now want to load it from my existing app. When I type newformname.showdialog I get an error saying newformname not found. Solution Explorer shows newformname under My Project.

I know this isn't tough but I need help getting unstuck. THanks.
0
tmostad
Asked:
tmostad
  • 4
  • 3
  • 2
  • +1
1 Solution
 
Raynard7Commented:
What namespace is your new form in? is in the same as the rest of the project?
0
 
tmostadAuthor Commented:
Good question. How do I figure that out?
0
 
Raynard7Commented:
Look at the code where you are trying to call it from - it should say namespace .... at the top
then look at the code of the form it should have something similar

if they are in different namespaces then you need to either change them so they are the same - or refer to the other. ie namespace.formname.arguement
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
newyuppieCommented:
go to the code of your form and check out what the Class name is for the form, that is the name you should be addressing no matter what the name is on the Solution Explorer, they can be different.
0
 
VoteyDiscipleCommented:
Two things in the "obvious but perhaps overlooked" genre:
1.  Make sure the actual name of the form is what you think it is -- just seeing NewFormName under Solution Explorer doesn't mean the form is actually named NewFormName; check the property sheet for that.

2.  You may already be doing this, but don't forget in .NET you have to do something like..

Dim frmX As New NewFormName
frmX.ShowDialog()

(That is, you can't directly write NewFormName.ShowDialog().)


You've probably already considered both, but this is one of these cases where spending eight hours hunting for a really complicated solution and finding out it was really simple would be pretty annoying so I figured I'd throw it out there.  (-:
0
 
newyuppieCommented:
hi votey,
2) actually i believe that in vb2005 you can call the show dialog without instantiating the form (different from 2003 behaviour). but correct me if im wrong.
1) its what i posted just before you.
0
 
tmostadAuthor Commented:
I knew it was brain dead simple except when your brain is dead then all bets are off. It turned out that my form Class name had a typo and didn't match the file name listed in Solution Explorer. Thanks to all who made suggestions. This forum is well worth the money I paid.
0
 
newyuppieCommented:
thanks.
but as you can see i had suggested that first.
0
 
tmostadAuthor Commented:
Yeah, I got the points wrong. I'll ask to get it fixed or find another way to push a couple hundred more points your way. Sorry about that.
0
 
newyuppieCommented:
many thanks, i didnt mean to cause a fuss, but thanks.
NY
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now