|
Your app will have two threads in it - the primary thread which creates your form and control and then spends most of its life idling but handles button clicks and the like, and the worker thread which churns away in the background.
This worker thread wants to update the GUI but we can't allow this - this must be done by the primary thread. If you do the update on worker thread all will seem well and then one day your program will hang and your life goes down the toilet. This is where BeginInvoke comes in, the worker thread calls this to get the primary thread to do the update for it. I'm not 100% on this but I think it does a PostMessage under the covers.
I'll put a sample together and email it to you. Are you using VS2003 or VS2005? Incidentally, I understand that VS2005 complains if you attempt to update the GUI from the worker thread - this is not the case in 2003.
Regards,
Rob Philpott.
|
|
|
|
|
I'm using VS2005 beta version..
|
|
|
|
|
Will for just an easy way to get access to the text box in simple thoughts
you just have to go to the Form Designer Code And Then change
private System.Windows.Forms.TextBox textBox1;
to
public static System.Windows.Forms.TextBox textBox1;
and also change all
this.textBox1....etc
to
Form1.textBox1....etc
and then you can control the textbox from the class or any where...;D
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
class testing_textbxx
{
int a;
public void change()
{
Form1.textBox1.Text = "This is a good way for Solving";
}
}
|
|
|
|
|
You could do this, but I'd argue it's not the way forward. It defeats the purpose of encapsulation and leads to hideously structured code. And you can't control the textbox from anywhere - doing this from a worker thread as in this example is positively dangerous.
Regards,
Rob Philpott.
|
|
|
|
|
1, do ne one know how to avoid the access prompt that come up when you access emails through code.
2, it prompt several times when u access different Public Properties of MailItemClass's object.
3, How to access the Mail Profiles and Accounts. as I want to send an email through ne particular email account.
Thanks
|
|
|
|
|
The security message box pops up due to the security mechanism in the Outlook object model. One of the ways to circumvent this is to use this Outlook Redemption library here is the link:
http://www.dimastr.com/redemption/
Here is some more info on Outlook security.
http://www.outlookcode.com/d/sec.htm
Also you will find more information about Outlook programing on outlookcode.com
Hope this helps.
|
|
|
|
|
Printing seems to be a pain in .NET. I am currently working on a Word Processor in C# that I started a while back to learn C#. The application is pretty much done except for printing. I can't seem to get formatting to show up in printing or previewing. Is it possible to have a WYSIWYG printing? Wanted to finish it while I'm on Christmas break.
Thanks
|
|
|
|
|
Try this:
http://www.c-sharpcorner.com/winforms/texteditor.asp
http://www.ondotnet.com/pub/a/dotnet/2002/06/24/printing.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp
"Don't worry about the world coming to an end today. It's already tomorrow in Australia"
|
|
|
|
|
|
Hi,
I want the details of IE window as soon as IE window is opened either by double clicking from Desktop icon or from Start menu. So is there any event which gets fired when the IE window is opened which I can capture in my program. My program will be a Windows service written in C#.
Please let me know how it can be done.
Thanks in advance.
Sunil
|
|
|
|
|
Here is a function I wrote that checks if Internet Exlplorer is running and if it is, the function returns true. You can put this function in a function of a Timer class that executes the IsExplorerRunning function at a specified interval - therefore checking every let's say 100 milliseconds. Let me know if you have any questions.
Make sure you include System.Diagnostics:
using System.Diagnostics;//put at the beginning
//put function in class
private bool IsExplorerRunning()
{
Process[] myProcess = Process.GetProcesses();
int i = 0;
try
{
while (myProcess[i] != null)
{
if (myProcess[i].ProcessName.ToUpper() == "IEXPLORE")
{
int i2 = 0;
try
{
while (myProcess[i2] != null)
{
myProcess[i2].Close();
i2 += 1;
}
}
catch { }
return true;
}
i += 1;
}
}
catch { }
int i3 = 0;
try
{
while (myProcess[i3] != null)
{
myProcess[i3].Close();
i3 += 1;
}
}
catch { }
return false;
}
|
|
|
|
|
Hi,
Thanks for your solution. But won't it slow down the system running this code every 100 milliseconds?
Regards,
Sunil
|
|
|
|
|
It works fine on my computer, but I agree there should be a more efficient way of checking. Note the function doesn't contain the code for the Timer object - you can add that to it if you need to. This function checks if Internet Explorer is running. There should be another function which invokes this (IExplorer checking function) The Process object doesn't seem to have a function that checks if a program has started running. If you find a class that has a function that checks that, you don't need the Timer object function to check every so milliseconds.
|
|
|
|
|
I may be wrong but I think if you create a new instance of the internet explorer object and one already exists it will take ownership of the running process
as for the timer object, I would instead start a running thread and set it to sleep for an acceptable durration of time, upon waking it does the check.
|
|
|
|
|
I agree about the thread sleep solution. I didn't have it on a thread though, but it would be better to have it on a separate thread. This was just an example - if you want to you can modify the function so it accepts a ref parameter. Then pass your existing object as a ref parameter to this function.
|
|
|
|
|
I am using C# 2005 beta version. My problem is whenever I stop my code through a breakpoint while debugging the tooltips shown for the functions definations get bold and it remains bold afterwards for ever untill i restart my computer. I am too irritated with this bug. Do anyone know the solution to this problem.
Thanks in advance.
Regards
Sheel
Sheel Gohe
|
|
|
|
|
|
Just searched Google and this message bord without success. Therefore my question:
Is there a GUI library available (both, commercial or free) for creating Windows Forms applications with Windows Forms 2.0?
I'm looking for more advanced controls than currently present in the standard set, like the Visual Studio 2005 IDE uses itself (floating, attachable Windows etc.).
Thanks
Uwe
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
|
Thanks, Leppie!
I'm just browsing now...
Did you find any specific? The best would be to have a native .NET version of the great Codejock "Xtreme Command Bars" which I am using successfully for MFC already.
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
I was looking for a pretty and free docking control, but couldnt find any. Daniel from #dev suggested DockPanelSuite, which seems ok, but a but buggy and resource hungry. I did see various companies do the VS2005 style docking (which is vewy pwetty)
xacc.ide-0.1.1 released! :) Download and screenshots
|
|
|
|
|
you can also try look at NetAdvantage from Infragistics. I downloaded the trial version from the website and their docking windows is exactly like in VS 2005. Its pretty easy to use.
-- modified at 20:07 Tuesday 27th December, 2005
didnt realise infragistics gui tool is posted under http://www.devdirect.com/
|
|
|
|
|
Hi,
I have an desktop win application by c#.(not ASP.net app)
And I want other users to launch it from internet browser,
just like launch MS Word from IE, or launching it like
java applet from web page. What should I do to the c# code
so that it can behave like that ? Is it similar to the concept of web application ? How many ways can I adopt to achieve it ?
And how can the c# app to communicate with the web page that
it is launched ?
Thanks
|
|
|
|
|
vs 2005 has the right property set called "Click once" deployment which enhances winforms application versioning and deployment. By publishing it on a web server; your application will be accessible on a link... read my article on this search as "vwd"
Mikail Çetinkaya . The C# DEveloper
|
|
|
|
|
How can I convert a byte array to a double array FAST?
/\ |_ E X E GG
|
|
|
|