I have a problems wit sencond Form when I want teo open it in the first one.
I do exactly like it is in this video:
https://www.youtube.com/watch?v=AIGoSsz5Wwo
Bu when I write: Form2 openForm = new Form2(); I get an error: The type or namespace name 'Form2' could not be found (are you missing a using directive or an assembly reference?)
I noticed that Form1 name also don't recognize.
I try to clean/rebuild, delete .vs, bon, obj folders but nothing happend
Do you have any idea where the problem is?
I would be happy any idea and solution,
DomenI
Form2 code
Form1 code
The problem is with namespace. What is the best way to changeit?
In the video, the form1 and form2 are in the same namespace "ButtonClickOpenNewForm".
But in your demo, they are in different namespaces, "NFCapp" and "Mg74App".
If you want to access the class in another namespace, you need to add reference to the namespace first by steps Project -> Add Reference....
Then call it through the full namespace.
Mg74App.Form2 form2 = new Mg74App.Form2();
Related
I have two projects in the same solution and I have linked a class DatabaseFunctions.cs to the second one.
The problem is that when I reference it in the GUI_Teacher.cs I get the error:
Error CS0246 The type or namespace name 'DatabaseFunctions' could not be found (are you missing a using directive or an assembly reference?) Teachers application C:\Users\user1\source\repos\IASLSN\Teachers application\GUI_Teacher.cs
From the error, you are simply missing a reference.
Take the following steps to add a reference
Right click on the GUI_Teacher.cs project and click on Add Reference
From the left side of the Add Reference dialog, click on Solution
Select DatabaseFunctions.cs from the list and click OK to close the dialog.
In the source file DatabaseFunctions.cs you have something like
using System;
namespace SomeNamespaceName
{
public class DatabaseFunctions
{
}
}
To use the class in your GUI_Teacher.cs source file you need to add either using SomeNamespaceName; at the top or use the fully qualified type name SomeNamespaceName.DatabaseFunctions instead.
Keep in mind that the name of a sourcecode file like your DatabaseFunctions.cs for example has no connection to the name of a class or a namespace in that file. You can put a class like public class DatabaseFunctions { } in a file called foo.cs. And in the using directive at the top of your sourcefiles you provide a namespace and not a filename.
I have a c# application and I am adding a new button. When the button gets clicked I want to execute the following line:
WelcomeScreen channelBar = new WelcomeScreen(true, "http://www.trade-ideas.com/cms_static/ChannelBar/channelbar.html");
The problem is when I try to compile, I get the error message:
The type or namespace name 'WelcomeScreen' could not be found (are you missing a using directive or an assembly reference?)
WelcomeScreen is a class in a dll that I have referenced: TIProGUI. Any ideas what I need to do?
It could be that your "using" statements don't fully qualify the reference. For example System and System.Web.UI.WebControls will have separate uses.
i trying to call a form as show dialog in in main coding
i have added below screen shot to help you guys under what i am asking. I have tried search on the internet but wasn't able to find a solution too.
but itemsDeleteScreen,itemsEditScreen and AddScreens works perfectly
image screenshot - http://i.stack.imgur.com/E66du.png
the items DeleteScreen Code : (Which Works)
itemsDeleteScreen deleteItem = new itemsDeleteScreen();
deleteItem.ShowDialog(this); // loads the Delete Items Screen
the StockInsScreen Code : (Whic Does not Work)
stockInsScreen stkIns = new stockInsScreen();
stockInsScreen.ShowDialog(this);
the error which i getting when i compile is
The type or namespace name 'stockInsScreen' could not be found (are you missing a using directive or an assembly reference?)
Navigate to StockInScreen Class and check the namespace, it would be like(yourproject.foldername) and add that name space in the class you want to use.(Source:From Image you have provided).For information about namespace,look at http://msdn.microsoft.com/en-us/library/z2kcy19k.aspx
On trying to build, all of a sudden (a couple of days since I worked on this project) I get:
"The type or namespace name 'IO' does not exist in the class or namespace 'OpenNETCF' (are you missing an assembly reference?)"
But when I comment out that line (using OpenNETCF.IO.Ports;), I get:
? OpenNETCF.IO.Ports.Handshake (multiple choices...)?
When I click that, the choices are two:
OpenNETCF.IO.Ports.Handshake
- and:
OpenNETCF.IO.Serial.Handshake
As the code in this unit deals with printing, I select "Ports" (rejecting "Serial" because of its yin/yanginess to "Parallel"). So it then adds back the using I had which it complained about (using OpenNETCF.IO.Ports)...and then it's back to the original err msg.
Yet I do have several OpenNETCF items in my References, namely:
OpenNETCF
OpenNETCF.Data
OpenNETCF.Drawing
OpenNETCF.Net
OpenNETCF.Phone
OpenNETCF.VisualBasic // I don't know why, this is a C# project
OpenNETCF.Web.Services2
OpenNETCF.Windows.Forms
OpenNETCF.WindowsCE.Forms
OpenNETCF.Xml
What could possibly cause this chicken-and-egg tail-chasing exercise in frustration?
Odder yet, I get, "The type or namespace name 'Windows' does not exist in the class or namespace 'OpenNETCF' (are you missing an assembly reference?)" pointing to this using in another .cs file:
using OpenNETCF.Windows.Forms;
...and yet that using is grayed out as being unused at any rate, but when I comment it out, I get a lot of other errors purportedly because it's gone, such as on this line:
IntPtr hwnd = OpenNETCF.Win32.Win32Window.GetCapture();
The type or namespace name 'Win32Window' does not exist in the class or namespace 'OpenNETCF.Win32' (are you missing an assembly reference?)
UPDATE
In another episode of "Well Flip My Bits!" I just now compiled, got those err msgs about not being able to reconcile this line of code with what is installed and configured, etc., scrolled up to see that the "using" it was supposedly missing was there, compiled again, and now it compiles fine. What the blue blazes?!?!?!?
This sounds like a problem you see when you are building a project for a "Client Profile" .net version while referencing assemblies that are not supported in client profile.
Try changing your project's build settings to use a .net framework version that is not "Client Profile".
One can use the namespace using inside class also, so consider moving it there, if there are classes that use both than use the full name as in OpenNETCF.IO.Ports.Handshake handshake = new OpenNETCF.IO.Ports.Handshake()
And for the class using namespace:
using System;
namespace MyNamespace
{
using OpenNETCF.IO.Ports;
//...
}
I'm having a brain freeze moment today. I must've done this many times but just can't work it out:
All i'm doing is running the following, but it's not saying releasestable is right.
Error 55 The type or namespace name 'releasestable' could not be found (are you missing a using directive or an assembly reference?) C:\Users\tomb\Documents\Visual Studio 2010\Projects\Findnzbs\Findnzbs\latestreleases.aspx.cs 16 11 Findnzbs
Heres the code:
releasestable webUserControl = (releasestable)Page.LoadControl("~/controls/releasestable.ascx");
webUserControl.listWhere = "myWhere";
phReleases.Controls.Add(webUserControl);
because you need to add it on the top of your code
like
using System.Collections;
using System.Data;
using Findnzbs.Controls;
is it
releasestable webUserControl (releasestable)Page.LoadControl("~/controls/releasestable.ascx");
webUserControl.listWhere = "myWhere";
or
releasestable webUserControl= (releasestable)Page.LoadControl("~/controls/releasestable.ascx");
webUserControl.listWhere = "myWhere";
Ok then the solution is add your namespace of the control.
example
if your application name is demoproject, then add
using demoproject.Controls;
where Controls is the folder were you have control code.
in your case it is Controls. so just copy paste the above line