|
DAteTime has a DayOfWeek property. Once you know that, working out the week is pretty trivial.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have written my first C# program using MS VC# 2005 Express Edition Beta (and my first C# period).
I have a dialog that runs and this dialog copies 100's of files and displays it's progress on the dialog (to, from, name, counts, etc.).
All of this works fine.
The problem is, what if I want to abort the process?
I can not use the Cancel button on the dialog as the program is running (busy coping the files) and thus can not respond to the click.
I even created an asynchronous process with a very simple dialog with just one button, a Cancel button. This would work fine for the first 6 seconds. Then all updates to both dialogs would stop even through the copy process was still running. Even the simple cancel dialog was still running as I could click the Cancel button to stop the copy process. It is just that after about 6 seconds neither dialog could be updated with new data. Using Update or Refresh did not work. NOTE: Neither process was trying to access a control on a dialog on the other process as I read this was a no-no.
Thanks for any help
|
|
|
|
|
You need to do your operations in a seperate thread, so they don't block the UI from responding.
And if this is your first C# program, you need to ditch any GUI development and write some console code first, to learn the language a bit before you start thinking about message loops and threads.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I think I did it.
It appears that all is working now.
The dialog box is running and displaying and the buttons work all while the backup engine is running.
|
|
|
|
|
Hello,
I have 2 Grids, that have same DataSource (which is a dataview). However, I want to setup the RowFilter differently for 2 Grids, so that the information displayed is different. Any ideas on how to do that?
Or do I have to create 2 separate dataviews as well?
Thank you
|
|
|
|
|
You need two separate DataViews.
The idea is that you can manipulate a DataTable from multiple DataViews.
|
|
|
|
|
Sorry for the lengthy title.
My problem is that I have a dialog in my application that I want to open in a modal fashion. But I want to be able to open another window from that modal dialog and interact between only these two windows, nothing else in the application (for doing some drag drop things between lists in these two windows).
How can I do this?
thankful for your suggestion,
Bjorn
|
|
|
|
|
No going to happen like this. THe modal window is either going to be System Modal or Application Modal. Meaning that is System Modal, the user can't switch to any other window in the system until this window is closed. Application Modal means that you can't switch to any other form owned by the application that opened the modal window.
You'll have to implement this using some other scheme other than using Modal forms. Off the top of my head, you could possibly host both of your forms that you want to display inside another, modal, form. This way, you can do anything you want between the two forms while they sit inside a parent form. I know, you think I smoking something illegal. But, the Form class inherits from Control, just any any other forms based control. The Form class also has a hidden property called .TopLevel . It won't show up in Intellisense, but it does work. You can read more about the technique here[^]. Warning! This article contains nothing but VB code!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To do this would either require listening to the Window's message pump and syphonining off the message to your exception window or doing a special object that derives from Form that has this behavior. Neither or which are appealing at all and I highly recommend you do not go down this road.
Instead you should rethink your UI design. Having a modal dialog for all except one dialog means you should consider doing something else with either if not both dialogs since they both seem to violate UI design expectations.
|
|
|
|
|
One bit of a messy way of solving this is to trap the 'Activated' event in all the non-"modal" forms. Whenever the event is received, call one of the "modal" forms' BringToFront method.
|
|
|
|
|
what do you guys think about creating another standalone application which I start and hide at startup of my application, and then send a message to it telling it to display and go topmost when i open my modal dialog box? And then define some custom messages to handle the interaction? All I want to drag and drop is some simple text strings so should not be a problem between different applications...
please give an opinion of you think its a stupid /hard to realize/other idea.
|
|
|
|
|
hey
workin on a program that will change what i type into textBox1 then change it into something else in textBox2, as a encryption so to say.
code:
string message;
textBox1.Text = message;
message.ToLower();
for (int nChar = 0; nChar < message.Length; nChar += 1)
{
char lNS = message[nChar];
}
am i doing this right?
or can someone explain to me the steps, it still isn't very clear to me.
|
|
|
|
|
Looks like you've got textBox1.Text = message swapped around:
message = textBox1.Text;
in the end, you'll want to add the characters back to a string:
result += lNS;
(where result is a string)
and then assign it to your second text box:
textBox2.Text = result;
|
|
|
|
|
My project contains 2 groupboxes each with a heavy custom control inside. I can doublebuffer the mainform by calling SetStyle in the constructor, but the style change doesn't propagate to the groupbox, and since SetStyle is protected I can't call do Gb.SetStyle(...) within my forms constructor. The setsyle message does propagate to panels, but the border is different, and even with a label stuck overtop doesn't look as astheticly pleasing. Is there any way I can force the gb to be double buffered?
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer,true);
|
|
|
|
|
Followup, I've tried deriving a new class from System.Windows.Forms.GroupBox and doing SetStyle(...) both in the constructor and in a seperate EnableDoubleBuffer() method, both unsuccessfully.
|
|
|
|
|
hi to all,
i have an mdi container in a c# win application.
i tried to put a control (LinkLabel) on my mdi container, when i open an mdi child i always have my LinkLabel on top (it is always visible in my mdi child).
i tried send it back of the screen but i have the same problem
so my question is : 1 - can we put a control into an mdi container c# form
2 - if yes, how can i do it without having the problem above
best regards and thanks in advance
fady
|
|
|
|
|
Hello,
Is there a way of colouring specific rows in DataGrid? I don't allow user to add any rows, so number of rows does not change, and I want to set the BackColour for a row (1 for example) to something else. Any ideas?
Thank you.
|
|
|
|
|
If you type 'DataGrid color' into that little search field at the top right beneath the little green CodeProject guy you will get an article explaining everything you need.
|
|
|
|
|
i just want to display menu and thats it but i can't seem to do this with out showing a dialog box, any ideas? I am using Visual C# 2005 beta 2 express edition
IM PROUD TO BE A GMAIL;
|
|
|
|
|
hi there,
today i realized a really strange behaviour of windows services.
i made a windows service that regularly checks some network services.
i wrote a class to perform these checks. it works perfectly when i wrap
it into a userspace program (command line).
but the same piece of code always refuses to connect when wrapped into
a windows service. is there something i have to obey when doing
network programming with windows services?
thanks,
j.
|
|
|
|
|
First what user account is your service running under?
Local System accounts will not have access to network resources. The easy solution is to go to the services and set the service to run under your account. Then it would have the same rights you have.
D Nuckolls
"If you think its expensive to hire a Professional...
Wait till you hire an Amateur!"
|
|
|
|
|
i tried my account (is in domain admin group),tried local system account (ok,now i know that this definitely doesn´t work and Domain Administrator Account, it´s all the same. now i just run the networking stuff wrapped in a commandline tool with task scheduler, but a windows service would my favourite choice...
thanks though
j.
|
|
|
|
|
what is "using System.CodeDom.Compiler"
msdn reads "The System.CodeDom.Compiler namespace contains types for managing the generation and compilation of source code in supported programming languages"
but what makes differrence to include/exclude this namespace
|
|
|
|
|
How to read e-mail from server from my application and then parse XML attachment?
Vlada Nesic
|
|
|
|
|
Hi Vlada,
have a look at this article within CodeProject:
http://www.codeproject.com/csharp/despop3client.asp
This article covers how to obtain mails from an email server.
If you have any further questions, don't hesitate to post again.
Regards
Sebastian
|
|
|
|