|
Yes, of course.
Create a WashingDay object using the System.Globalization.Calendar class. Then you add any cloth items to it's Items collection. Remember to associate each item with a WashingType object first, though, or you will end up with pink shirts. When you added all the clothes, subscribe to the OnComplete event and execute the WashingDay.Start method.
---
b { font-weight: normal; }
|
|
|
|
|
|
My C# Express IDE suddenly(?) doesn't let meswithc betweenn debug and release anymore.
Currently it builds the library project as release, and the test env as debug. Weird (but maybe poking aorund I changed it).
"Solution Configuration" is disabled, hunting the menus (or customizing the toolbar) doesn't reveal anything.
I already tried resetting the IDE config, but this didn't help
Any suggestions?
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
Had the same problem. THe following steps should work.
1. Go to Tools->Options and check the "Show All Settings" at the bottom of the dialog
2. Expand Projects/Solutions, click on General and check the "Show advanced build configurations" checkbox".
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks! that worked!
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
I found (without finding that checkbox mentioned below) that it would build the debug when you try to run it thru the debugger, and it would build the release if you clicked on "build solution" in the build toolbar.
|
|
|
|
|
Hi i made a Modal DIalog Box( showdialog() )
Its on top and everything, but the application who calls it( another enviroment ) steals back the focus, but with my modal dialog box on top still. This annoys me! meaning i cannot just press enter to move along, but need to get focus back to my dialog form, before i press enter.
How can i make sure that it(dialogbox) always have focus over other applications, that nothing takes it away.
is there some windows api i can call or something, i have been looking but with no luck.
Thx in advance
|
|
|
|
|
|
I have tried that, bu the application that called my Dialog window snatched focus back, and was hiding behind my dialog.
But i found a working solution through the User32.dll call.
[DllImport("user32.dll", SetLastError=true)]
static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
SwitchToThisWindow(this.Handle, false);
It activates my window/dialog.
Thx though for the answer
|
|
|
|
|
I am a newbie to delegates and events. I want an event to be raised when a variable has been changed. How exactly do i do that? Can someone show me the code (raising the event, and the handler)
thx thx
|
|
|
|
|
Create a delegate (I normally put it with [not in, delegates go outside the class] the EventArgs derived class):
public delegate void ValueUpdated(object sender, ValueUpdatedEventArgs e);
Then create an EventArgs derived class. Although this is not strictly necessary, it is good practice so that all events have a similar look and feel.:
public class ValueUpdatedEventArgs : System.EventArgs
{
private string newValue;
public ValueUpdatedEventArgs(string newValue)
{
this.newValue = newValue;
}
public string NewValue
{
get
{
return this.newValue;
}
}
} Of course, you can add more information in here if you need it, for example, you may wish to add a field and property for variable name if that is important.
In the class where the event will be raised add this line (I usually put it just after the field definitions):
public event ValueUpdated ValueUpdated; The first ValueUpdated refers to the delegate, the second is the name of the event that will be raised - If you are going to raise several different events, because, for example, you have several different variables changing that you want notified of, you may wish to change the name.
Now, when the value is updated you can call the observers (the objects that are subscribed to the event):
this.myVariable = "My New Value";
ValueUpdatedEventArgs valueArgs =
new ValueUpdatedEventArgs(this.myVariable);
ValueUpdated(this, valueArgs);
Does this help?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
I would add one more comment:
Make myVariable a property - that way you can refactor the call to ValueUpdated() in the property's set() method.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Yes, abosolutely!
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Is there a terribly convincing reason for the Framework rule to declare event delegates as (object sender, EventArgs e) ?
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
peterchen wrote: Is there a terribly convincing reason for the Framework rule to declare event delegates as (object sender, EventArgs e) ?
I believe that the reason is this:
Most framework controls store their events on an array-like structure when they are used, to decrease their memory size. Since those controls have *lots* of events, and tipically, only a few are actually used by an application, the framework can reduce the memory use by a few KB and even a few MB in a large application by not declaring fields for storing all of them.
Since the events are to be added/removed on an array for *each* event, someone probably needed to code some kind of generic code for dealing with this management.
This probably lead to creating a single delegate to ease things.
Not a pretty solution, but very efficient.
I don't see dead pixels anymore...
Yes, even I am blogging now!
|
|
|
|
|
Hey all, I have a custom collection of controls that I have built that do data validation and all that stuff internally and I want to use an ErrorProvider to alert the user to any validation errors. Now, instead of creating and using one ErrorProvider per control I put on a form, I would rather use just the one ErrorProvider put on the form.
At runtime, I was hoping to be able to search through the form's components or something to that effect and find the ErrorProvider myself. This way, any control I put on a form would automatically 'discover' the ErrorProvider on the form if it is present. I can't seem to find a way to do this however. In the control, properties such as "this.Container" or "this.FindForm().Container" or "this.FindForm().Site" are all null, and they seem to me to be the only paths to the components collection i'm looking for.
I don't know if this is possible. Any help or insight would be greatly appreciated.
|
|
|
|
|
Hello,
I need to read the contents of the .pdf file thru my application in C# and get the contents of the file.
I'm getting lots of links for creating .pdf files thru C#.
Also, I need to know about how difficult it is build the pdf parser for reading the contents???
Regards
Abhishek
|
|
|
|
|
I'm currently in the middle of a pdf project, and have found that this http://itextsharp.sourceforge.net/ does everything that I could possibly need, including reading/filling out form fields forms and whatnot. Not very tricky at all, as the clever blokes who wrote it have already figured it out. Hope that helps...
|
|
|
|
|
Hello,
I have a C# program I'm working on, and I finally got over a large hurdle, only to encounter the next. I finally am able to display an image in my form (Working on a PocketPC), as well as other info that is located in an XML file.
The problem is, is that I think the SelectedItem Property isn't syncing with the rest of the items....
Could someone tell me where i'm going wrong? I'd really appreciate input.
Here it goes:
<br />
xmlFileName = "\\Program Files\\SmartDeviceApplication1\\fragenkatalog.xml";<br />
xsdFileName = "\\Program Files\\SmartDeviceApplication1\\fragenkatalog.xsd";<br />
FileStream FsXML = new FileStream(xmlFileName,FileMode.Open);<br />
FileStream FsXSD = new FileStream(xsdFileName,FileMode.Open);<br />
<br />
<br />
XmlTextReader xtrXSD = new XmlTextReader(FsXSD);<br />
fragenkatalogDS.ReadXmlSchema(xtrXSD);<br />
xtrXSD.Close();<br />
FsXSD.Close();<br />
<br />
XmlTextReader xtrXML = new XmlTextReader(FsXML);<br />
fragenkatalogDS.ReadXml(xtrXML);<br />
xtrXML.Close();<br />
FsXML.Close();<br />
<br />
DataTable dt = fragenkatalogDS.Tables["fragenkatalog"];<br />
<br />
ca_id.DataSource = dt;<br />
ca_id.DisplayMember = "ca_titel";<br />
string root = "\\Program Files\\SmartDeviceApplication1\\";<br />
DataRowView drv = (DataRowView)ca_id.SelectedItem;<br />
<br />
ca_bildurl.Image = new Bitmap(System.IO.Path.Combine(root,drv.Row["ca_bildurl1"].ToString()));<br />
ca_titel.DataBindings.Add("Text",dt,"ca_titel");<br />
ca_alter.DataBindings.Add("Text",dt,"ca_alter");<br />
ca_sex.DataBindings.Add("Text",dt,"ca_sex");<br />
burl.DataBindings.Add("Text",dt,"ca_bildurl1");<br />
<br />
}
The problem I've been having (I think) is with this line:
DataRowView drv = (DataRowView)ca_id.SelectedItem;
It seems as though it's not displaying any other image other than the first one in the database. Any ideas?
Thanks a million!
Martina
|
|
|
|
|
need more code...
if your seeing the same result without a crash your probably acessing the parent object in your heirarchy. what control is ca_id ?
|
|
|
|
|
Here's my XML code:
<fragenkatalog>
<ca_id >4</ ca_id>
<ca_titel>head ap</ca_titel>
<ca_bildurl1>kopf_ap.jpg</ca_bildurl1>
<ca_disabled>0</ca_disabled>
<ca_alter>999</ca_alter>
<ca_sex>n</ca_sex>
</fragenkatalog>
And the cs code
public ADONETDataBinding()
{
InitializeComponent();
fragenkatalogDS = new DataSet();
fragenkatalogDS.Locale = CultureInfo.CurrentCulture;string xmlFileName;
xmlFileName = "\\Program Files\\SmartDeviceApplication1\\fragenkatalog.xml";
xsdFileName = "\\Program Files\\SmartDeviceApplication1\\fragenkatalog.xsd";
FileStream FsXML = new FileStream(xmlFileName,FileMode.Open);
FileStream FsXSD = new FileStream(xsdFileName,FileMode.Open);
XmlTextReader xtrXSD = new XmlTextReader(FsXSD);
fragenkatalogDS.ReadXmlSchema(xtrXSD);
xtrXSD.Close();
FsXSD.Close();
XmlTextReader xtrXML = new XmlTextReader(FsXML);
fragenkatalogDS.ReadXml(xtrXML);
xtrXML.Close();
FsXML.Close();
DataTable dt = fragenkatalogDS.Tables["fragenkatalog"];
ca_id.DataSource = dt;
ca_id.DisplayMember = "ca_titel";
string root = "\\Program Files\\SmartDeviceApplication1\\";
DataRowView drv = (DataRowView)ca_id.SelectedItem;
ca_bildurl.Image = new Bitmap(System.IO.Path.Combine(root,drv.Row["ca_bildurl1"].ToString()));
ca_titel.DataBindings.Add("Text",dt,"ca_titel");
ca_alter.DataBindings.Add("Text",dt,"ca_alter");
ca_sex.DataBindings.Add("Text",dt,"ca_sex");
burl.DataBindings.Add("Text",dt,"ca_bildurl1");
}
/// <summary>
///
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
Thanks again!
|
|
|
|
|
As a side note, (for what it's worth)
If I remove the 1st image listed (kopf.jpg) from the directory (i.e. I delete the jpg file), the whole program doesn't work. :S
|
|
|
|
|
I'm thinking about writing a simple alarm clock for myself so I've just been doing some research looking at how some other ones have been desinged and most programs I've looked at use a timer to check if an alarm time has been hit. I'm just wondering if this is the best way to do it or if there is another way that would accomplish the same thing.
Thanks for the information.
- Aaron
|
|
|
|
|
monrobot13 wrote: use a timer to check if an alarm time has been hit
That seems about right. You could get by with a single (reasonably high resolution - eg: < 1 Sec.) timer or one timer per alarm (assuming you can have multiple alarms). A single timer is of course less resource intensive.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks very much for the info.
- Aaron
|
|
|
|