|
Thats great.
Regards,
Arun Kumar.A
|
|
|
|
|
Hi guys, I want to know if there is a way to share a resource file between two C# projects under one solution in VS2005. For instance,
Project1
-Class1.cs
-Class2.cs
-Resource.resx
Project2 - references Project1
-ClassA
Can sombody give me some example or a resouce
Thanks
|
|
|
|
|
You could set up a class in the project with the resource that gets the resources. The second project could use that class to get the resources it needs.
|
|
|
|
|
Can you please provide me some example or a link where I can get it.
Thanks
|
|
|
|
|
Hello,
I have two modes of running my application,
one is UI mode and the other is non UI mode, I have a flag to check whether the operator is in UI or Non- ui mode.,
In non ui mode i try not to show the UI,
private void App_Load(object sender, EventArgs e)
{
if (!m_fUI)
{
//In non ui mode check for the Source mode XML or LDAP
this.Visible = false;
this.ShowInTaskbar = false;
}
}
but as soon as i change the mode the UI goes of and again pops up... Can some pls suggest how to go about?
|
|
|
|
|
I've had the same problem, its somehow due to the way that C# instantiates the form (it always starts visible).
You can't 'hide' the form from the OnLoad event of the form - and the App has to be running before you can hide it.
Two possible solutions (but these might not be the best:
i) Don't create the form in your app entry point, usually program.cs>main actually runs it up.
If you dont need the form code then you should be separating that code out anyway - and the form should be run up as part of your main class'es start up
ii)Set your 'form state' to minimised and set 'show in taskbar' to false - then it wont actually appear anywhere.
This will show up in the ALT-TAB list but one the form is created in main you can then hide it as some later start up code - after the OnLoad event.
|
|
|
|
|
I tried the second option but did not work... can u explain me of the option 1.
|
|
|
|
|
Option 2)
Create your form like normal.
Go to your application main entry point(usually in program.cs ) which should look something like this:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
And change it to:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(frm);
Form1 frm = new Form1();
if (-put your test here-)
{
frm.Show();
}
do
{
System.Windows.Forms.Application.DoEvents();
} while (!frm.IsDisposed);
}
}
Oh, btw while looking for the best way to test the form i also ran across this in the VS2005 MSDN:
"How to: Make a Startup Windows Form Invisible "
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_mancli/html/98792c58-ec32-4086-8a62-c101c0cc4e88.htm
-- modified at 20:57 Sunday 29th April, 2007
|
|
|
|
|
Hi,
Briefly. FormMain has a single button to spawn Form A. Form A allows to user to do work, submits request to server, upon return auto prints the results.
The problem : After the print, FormMain pops to the top and takes focus, but I want Form A to remain in focus after the print.
FormMain has no functions (that I made) that is called from Form A.
If I step through it in debug mode, focus seems to remain on Form A.
I've tried Focus() and Activate() after the print, but still FormMain takes focus.
Why is this happening and how can I stop it?
|
|
|
|
|
With this explanation, this whole thing seems to be a real mystery, plz give some code to help people get hold of the situation
Rocky
|
|
|
|
|
Please if you know how to copy items between 2 listboxes using a drag and drop operation help me out.
rzvme
|
|
|
|
|
rzvme wrote: to copy items between 2 listboxes using a drag and drop operation help me out
This Google search[^] comes up with some good stuff. First one is here on CP. Hope this helps you out
|
|
|
|
|
None of the examples I found via googling actually were complete or bug free. Actually getting one to fully work was almost a weeks worth of pain. If I could do it over again, I'd've used a listview since it has more built in drag/drop support. I managed to get a drag/drop demo working with it in under a day with less than a month of language experiance.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Nish's article code seems to work pretty good. I don't know to what extent the OP is looking for.
|
|
|
|
|
hi
i was create a new instance of thread class and pass to it a method(with 1 parameter) and start then pass it's argument to method by this code :
//my method that get 1 argument
private void ShowWaitForm(string message)<br />
{<br />
Frm_Waiting fw = new Frm_Waiting();<br />
fw.label1.Text = message;<br />
fw.ShowDialog();<br />
}
// error in this line
System.Threading.Thread th = new System.Threading.Thread(this.ShowWaitForm);<br />
th.Start("Please Wait ...");
but the following error show me :
The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ThreadStart)' has some invalid arguments
and :
Argument '1': cannot convert from 'method group' to 'System.Threading.ThreadStart'
i was compile and run it without any problem 2 hours ago but now has error,
how to solve my problem ?
|
|
|
|
|
hdv212 wrote: System.Threading.Thread th = new System.Threading.Thread(this.ShowWaitForm);
Change it to
System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(ShowWaitForm));
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
1. You need to use a ParameterizedThreadStart:
System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(this.ShowWaitForm));
This allows your thread to run a Method that takes in a parameter and then start like you have done, but . . .
2. You need to change the interface of ShowWaitForm from
private void ShowWaitForm(string message)
to
private void ShowWaitForm(object message)
The delegate used by the ParameterizedThreadStart object references a function of type void that takes in an object as a parameter. You're giving it a function of type void that takes in a string instead. Once you've gotten this to work just cast the object to a string inside of ShowWaitForm .
|
|
|
|
|
I need to insert a special charater into the RichTextBox onclick a button.
But, if i did something like this:
richtextbox1.Text += "©";
The charater © will get added to towards the end of the richtextbox document, not where the IBeam (or the cursor) is pointing to.
How can i insert simple text at the exact position the Ibeam or the cursor is standing inside the richtextbox1 ?
|
|
|
|
|
I tried this code (onclick insert button)
MessageBox.Show("Top : " + richtextbox1.Cursor.Size.Height);
MessageBox.Show("Left : " + richtextbox1.Cursor.Size.Width);
But this kept giving me:
Top : 24
Left : 24
No matter where the Ibeam/cursor was...
|
|
|
|
|
that's giving you the size of the cursor, which should be apparent from the name. I'm just looking at the intelisence, might the rtb.SelectionStart property be what you want?
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
BRILLIANT!
i had no idea rtb had a variable like that
i used this to test it:
int pos = EditingArea.SelectionStart;
MessageBox.Show("Last Line : " + pos);
It always showed the exact position the IBeam/Cursor was at.
Now here comes my second problem, how do u insert the special char at the rtb.SelectionStart?
|
|
|
|
|
I tried to do something like this:
rtb.SelectionStart = rtb.SelectionStart + rtb.SelectionLength;
rtb.Text += "©";
This still doesn't help. Should i use rtb.Text.Insert(); ?
-- modified at 13:39 Wednesday 25th April, 2007
|
|
|
|
|
I think im almost there
this code always shows the exact position my IBeam/Cursor is standing on
int pos = rtb.SelectionStart + rtb.SelectionLength;
So, i thought i cud use it to insert the special char using the Text.Insert(); method:
rtb.Text.Insert(pos, "©");
Even this isnt working... why is it so hard to set position of text insertion? Im running out of ideas, can someone please help me out here... i did way too many trial and error and i still haven't found any solution yet...
|
|
|
|
|
1 hour wasted and i finally worked it out
this.richTextBox1.SelectedText = "©";
so simple... wish they had some sort of "how-to" document/wiki for each components such as richtextbox
|
|
|
|
|
Hi All,
My C# - VS2005 Application occasionally gives the NullReferenceException when the application is being debugged in Relase mode. It occurs when the program is left idle in debug mode for a long time around 30min.
Any idea why such an error could occur?
Please find the call-stack of the error.
System.Windows.Forms.dll!System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle waitHandle = {System.Threading.ManualResetEvent}) + 0x18 bytes <br />
System.Windows.Forms.dll!System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control caller, System.Delegate method, object[] args, bool synchronous) + 0x36d bytes <br />
System.Windows.Forms.dll!System.Windows.Forms.Control.Invoke(System.Delegate method, object[] args) + 0x48 bytes <br />
System.Windows.Forms.dll!System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback d, object state) + 0x61 bytes <br />
System.dll!Microsoft.Win32.SystemEvents.SystemEventInvokeInfo.Invoke(bool checkFinalization = true, object[] args = {Dimensions:[2]}) + 0x68 bytes <br />
System.dll!Microsoft.Win32.SystemEvents.RaiseEvent(bool checkFinalization = true, object key = {object}, object[] args = {Dimensions:[2]}) + 0x106 bytes <br />
System.dll!Microsoft.Win32.SystemEvents.OnUserPreferenceChanging(int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x6f bytes <br />
System.dll!Microsoft.Win32.SystemEvents.WindowProc(System.IntPtr hWnd = 591970, int msg = 8218, System.IntPtr wParam = 47, System.IntPtr lParam = 2201016) + 0x288 bytes
Any help will be great.
Arti Gujare
|
|
|
|