Dynamically adding usercontrol to placeholder - c#

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

Related

Cannot create object for DataGridBoolColumn in winform for datagrid in windows ce 6 app

I am trying to create an object of DataGridBoolColumn. But it is not in any namespace. Below is my simple code.
The type or namespace name 'DataGridBoolColumn' could not be found
(are you missing a using directive or an assembly
reference?) C:\Csharp
apps\PickerPayScreener\PickerPayScreener\Form1.cs 235 21 PickerPayScreener
I am getting a red squiggle line under DataGridBoolColumn.
DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue = false;
cs1.TrueValue = true;
cs1.FalseValue = false;
cs1.MappingName = "checked";
cs1.ReadOnly = false;
gdPickerDetail.TableStyles[0].GridColumnStyles.Add(cs1);
DataGridBoolColumn isn't supported in the .NET Compact Framework (used in Windows CE). See the MSDN page: https://msdn.microsoft.com/en-us/library/ms172499(v=vs.90).aspx
Try placing the below code at the start of your source code (.cs) file
using System.Windows.Forms;
Also make sure that your project references the assembly System.Windows.Forms.dll.
Try System.Windows.Forms.DataGridViewCheckBoxColumn Instead

Why do I get 'CultureAndRegionInfoBuilder not found' error?

Okay, this is a strange one.
I'm trying to create a custom culture in Xamarin using:
using System.Globalization;
...
var x = new CultureAndRegionInfoBuilder();
But I get the nasty red Resharper error with no options.
The type or namespace name 'CultureAndRegionInfoBuilder' does not exist in the namespace 'System.Globalization'
What's going on, am I missing something? Can't find any help on google...

Not Able To Initiate a Class in Main Coding

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

Why can Visual Studio detect which "using" is needed, but then say the type or class which provoked the addition of the reference does not exist?

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;
//...
}

missing a using directive or an assembly reference?

I am getting this error Error 4 The type or namespace name 'Sample' could not be found (are you missing a using directive or an assembly reference?) F:\oadmin\sea\Controls\Dlg.cs 11 7 Controls
here i added Samplein reference section,,,then i used it as Using Sample,,i dont know why i am getting this error
this is the class
namespace sample
{
public class Server
{
public class client
{
Bool sent = true
}
}
}
Can i share exe,,this Sample is an exe
Perhaps because your namespace is sample and not Sample?
So if your Dlg namespace is different it needs to have a using sample line not using Sample.
Or perhaps your class is in another project within your solution and you need to include the hierarchy of namespaces?
Your namespace "sample" is lowercase, but you are referring to it in uppercase "Sample" ...
EDIT: You Bool sent is internal, it cannot be accessed from outside of the assembly

Categories

Resources