|
I tried it again with App.config file. but same error is comming. pls can you help me?
Thanks
|
|
|
|
|
Probably not an error, but a warning. The appsettings is obsolete since VS.NET 2005.
Create a reference to System.Configuration and use :
System.Configuration.ConfigurationManager.AppSettings["SettingName"];
That should do the trick
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
I tried that again,
then it is an another error called:
The type or namespace name 'ConfigurationManager' does not exist in the class or namespace 'System.Configuration' (are you missing an assembly reference?)
I am a beginner for c# can you help me?
thank you
|
|
|
|
|
hi all,
i want to know how to restrict the class not to instaciate more than once in C# help me in this plse...
P.gurukiran
|
|
|
|
|
A private constructor and a create method. A static boolean flag that starts as false, is set true by the Create method, and returns null once that flag is true.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thank u Christian Graus , but i need any key words are available for it to restrict it is more help full
P.gurukiran
|
|
|
|
|
Christian Graus wrote: A private constructor and a create method. A static boolean flag that starts as false, is set true by the Create method, and returns null once that flag is true.
Ummmm.... I'm not sure how that describes a singleton. I've never used a Boolean flag in any of my singletons. They look a bit like this:
public SingletonClass
{
private static SingletonClass onlyInstance;
private SingletonClass()
{
}
public SingletonClass Instance
{
get
{
if (onlyInstance == null)
onlyInstance = new SingletonClass();
return onlyInstance;
}
}
}
|
|
|
|
|
where is the removed declared?
and how is onlyInstance initialised?
-Prakash
|
|
|
|
|
Mr.Prakash wrote: where is the removed declared?
and how is onlyInstance initialised?
The curious thing is that I thought I'd messed up my post, but when I went to modify it the code displays correctly in the edit window. "removed" should read "onlyInstance" and I have absolutely no idea why it says removed.
|
|
|
|
|
Looks like Bob is teasing you a little!!
Regards
|
|
|
|
|
hi Christian Graus, i am trying above code i am not able restrict the class please can u provide smple code it will help me lot
P.gurukiran
|
|
|
|
|
Hi,
my you use an static variable within the class
that counts the instances.
namespace ConsoleApplication1<br />
{<br />
class TestClass<br />
{<br />
public static int instanceCount = 0;<br />
<br />
public TestClass()<br />
{<br />
instanceCount++;<br />
}<br />
}<br />
<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
TestClass myTestClass1 = new TestClass();<br />
TestClass myTestClass2 = new TestClass();<br />
Console.WriteLine(TestClass.instanceCount);<br />
Console.ReadLine();<br />
}<br />
}<br />
}<br />
You can use the variable 'instanceCount' to restrict the instance generation.
Is it that what you're looking for?
Regards
Erik
|
|
|
|
|
I think the original poster was describing a singleton class.
|
|
|
|
|
your code sample can not be used to retrict the number of instances, it only helps in couting the instances.
As long as you keep the constructor public, it will be difficult (maybe impossible) to create a singleton class.
-Prakash
|
|
|
|
|
What you are looking for is called a Singleton:
public SingletonClass
{
private static SingletonClass onlyInstance;
private SingletonClass()
{
}
public SingletonClass Instance
{
get
{
if (onlyInstance == null)
onlyInstance = new SingletonClass();
return onlyInstance;
}
}
}
|
|
|
|
|
thank u Colin Angus Mackay
P.gurukiran
|
|
|
|
|
hi
i add an Unbound DataGridViewCheckBoxColumn to my datagridView for user to select each record that he wants to print (print with DataGridViewPrinter Class), I want to invisible other records that checkbox is False or null,
but at RunTime when i set a checkbox to true and uncheck it again (set to false)
when i want to invisible that record .. the following error shown me :
Row associated with the currency manager's position cannot be made invisible
my code is :
foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null)
{
if (_gridViewRow.Cells[0].Value.ToString() == "True")
{
_gridViewRow.Visible = true;
}
else if (_gridViewRow.Cells[0].Value.ToString() == "False")
{
_gridViewRow.Cells[0].Value = null;
ds_zamin1.Khaneh_1.Rows.RemoveAt(_gridViewRow.Index);
}
}
else
{
_gridViewRow.DataGridView.EndEdit();
_gridViewRow.Visible = false; //Error Occured In this Line
}
}
|
|
|
|
|
Hi,
I try to find a solution for changing the
font of a tooltip. I can find no method
or property.
Any idea?
Thanx in advance!
Erik
|
|
|
|
|
Hi,
In one of my project, I have to capture the Image of a control which is not visible / focused.
I have to capture & display the images of the controls which are placed on the different tabpages.
The thing is I can capture the image of the control when the control is visible and the focus is set to the parent tab page.
I tried with various methods but no success. One of the methods I have used is “CreateDIBSection”.
I have also tried using CreateGraphics method of the control.
It will be helpful if the Source code is posted,
Looking for your help.
Thanks in advance,
|
|
|
|
|
sachin41406 wrote: CreateDIBSection
Not going to help
There is no way I know of to get the image of a control that is not visible. Having said that, Vista seems to be doing it, but I suspect it's rendering an app in a smaller window, essentially moving it there.
If it's a control in your app, then you should be able to write a method, if it's a custom control, that renders the current state to a bitmap. Doing it for controls in your own app should be easy, think instead of trying to get a bitmap that doesn't exist, about the fact that you have all the state info for the control, you can rerender it where-ever you like.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi,
how can i remove a tooltip from a control?
my problem is i have a textchanged event, that should set a tooltip to an picture box by:
toolTip.SetToolTip(targetControl, caption);
--> the tooltip change with the content in the textbox, so when i execute again the SetToolTip function a new tooltip will be created, but the old one is already existing.
thats why i am looking for a function to remove the old tooltip...
|
|
|
|
|
Hi,
normally, this should work:
<br />
private void textBox1_TextChanged(object sender, EventArgs e)<br />
{<br />
toolTip1.SetToolTip(pictureBox1, textBox1.Text);<br />
}<br />
I created a picturebox named 'pictureBox1' and
placed the above code within the text-change eventhandler
of my textbox 'textBox1'. Anytime I changed the text
the tooltip will be updated. There are no multiple
tooltips on the picturebox. Maybe try the method RemoveAll()
of toolTip1.
Regards
Erik
|
|
|
|
|
Set the "AutoPopDelay" property of ToolTip.
Regards,
Bhupi Bhai.
|
|
|
|
|
Ok, my problem is i even don't have any reference to the tooltip object.
|
|
|
|
|
i think it will be better if u create tooltip object runtime
and on the textchange event u can dispose the old tool tip object by
toolTip.Diapose() method and create new instance of tooltip object
and set it again.
rahul
|
|
|
|