|
Hmmm - thanks for all this, it obviously explains one problem ( the double close behaviour ), although I'm surprised to hear that the buttons could be set this way, as I set them to none explicitly. This could be an indicator that the resx file is in a mess.
And if the resx file is screwed, that would explain the other behaviour as well.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello there
How can i add a new Refrence in a project in runtime??
Plz help me
Thanx
|
|
|
|
|
I am not sure that i understand what you mean.
But i assume you would like to dynamically load an assembly?
see the Assembly.Load documentation for this.
/cadi
24 hours is not enough
|
|
|
|
|
|
//I want to draw an X-Y coordinate system on a WinForm (400, 400). The only code I entered after cteating the Form is beween the comments. It doesn't lookk centered. Why? --thanks
static void Main()
{
Application.Run(new Form1());
}
PROBLEM IS HERE->//////////////////////////////////////////////////////////
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen myPen = new Pen(Color.Black, 1);
Rectangle rect = new Rectangle();
g.DrawLine(myPen, this.Width/2, 0, this.Width/2, this.Height);
g.DrawLine(myPen, 0, this.Height/2, this.Width, this.Height/2);
}
//////////////////////////////////////////////////////////////
|
|
|
|
|
Replace
g.DrawLine(myPen, 0, this.Height/2, this.Width, this.Height/2);
with
g.DrawLine(myPen, 0, this.ClientSize.Height/2, this.Width, this.ClientSize.Height/2);
this.Height probably includes the height of the menubar and titlebar also, that's why it didn't look centered.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
this.Heigth is the height of the window including any NC (Non Client) stuff (title bar, borders, scrollbars etc.)
Use the Control.ClientRect to get access to the actual size of the content area of a window.
<code>g.DrawLine(myPen, this.ClientRectangle.Width/2, 0, this.ClientRectangle.Width/2, this.ClientRectangle.Height);
g.DrawLine(myPen, 0, this.ClientRectangle.Height/2, this.ClientRectangle.Width, this.ClientRectangle.Height/2);
/cadi
24 hours is not enough
|
|
|
|
|
hello,
we use to log a lot of data a compact flash datalogger. I want to read out the cf-cards by copying all files to a new directory an delete the cf-card, so it can be reused.
My problem is now, how do i recognize in a c#-program, that there is a new cf-card. I think i need the information, what new drive name (e:, f:, g:...) the new inserted card has and then i have to copy the information to the disk.
Any hints may be usefull (also with other programming languages, if there is an other one more appropriate).
Thanks in advance,
Heiko.
|
|
|
|
|
your probably going to have to import a native library to do this, best thing to do is to search google and hope some one has already incapsulate this functionality
just like cd burning the .NET framework does not directly support this, you might be able to find the COM DLL on your own, but you would probably be hard pressed
sorry i can't help you more but your best bet is google for "cf-cards" and "C#"
|
|
|
|
|
hi everybody
anybody knows how can i save drop down box items in a text file?
thank you
|
|
|
|
|
Try something like this:
using (System.IO.StreamWriter sw = new System.IO.StreamWriter("test.txt",false))
{
foreach(object o in this.comboBox1.Items)
{
sw.WriteLine(o.ToString());
}
sw.Close();
}
/cadi
24 hours is not enough
|
|
|
|
|
The sw.Close call is redundant, the "using" statement automatically closes the StreamWriter when control reaches the end of the block.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yup, I know this is true for the StreamWriter (and should be for any class implementing the IDisposable interface).
I just can't get rid of the habit to be on the safe side.
And sometimes i have something like this:
using (x)
{
using(x.y)
{
x.Close();
}
}
by calling the x.Close i simply free the resource as soon as i do no longer need it, not as soon as the finally of the using statement is reached.
And finally you never know if the IDisposable.Dispose actually does implement all the stuff you expect it to contain.
OK, your are right... it is redundant (but i still have my points!)
/cadi
24 hours is not enough
|
|
|
|
|
Hmm. Just for the sake of argument,
using (x)
{
using(x.y)
{
x.Close();
}
}
After all, that's the sole purpose of the using statement
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hihi... you win...
/cadi
24 hours is not enough
|
|
|
|
|
hi
can anybody help me to see if a certain item exists in a drop down box?
thank you
|
|
|
|
|
Use the Contains function on the drop down box's Items property. Like
...
bool isItemPresent = comboBox.Items.Contains(itemToBeFound);
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks
but this code returns an error:
if (drpSelected.Items.Contains(lblID.Text) == false)
how can i convert my label text to an item?
|
|
|
|
|
Farhad Eftekhari wrote:
but this code returns an error:
Which one? It would be easier to help if you said what exactly that error says. (with stack trace if possible!)
Farhad Eftekhari wrote:
how can i convert my label text to an item?
You don't. If your drpSelected.Items contains array of string , than it works. If it does not, item text (displayed in control) are result of item's ToString() method. Now think about it. What Contains method need to find your item? It must be able to say if some item from items is (equals) to item you are searching for. So, in order to make THIS example work, you can a) have only strings in drpSelected.Items (so Contains will compare string references) or b) override Equals() method for items or c) if( drpSelected.Items.Contains( item ) ) . First option seems to be best, but then again we have no idea what your code *really* means.
[edit]
or you can create new item (e.g if( drpSelected.Items.Contains( new item(lblID.Text) ) ) )+ override Equals() . But that sounds quite stupid
hmmm it looks like your drop has something to do with IDs? I suspect your Item have properties Item.UserName and Item.ID , right? Don't you need only selected one? Than use SelectedValue instead of SelectedText . (you must fors say what is Value "column" -ListControl.DataValueField Property[^] )
[/edit]
Does it help?
David
|
|
|
|
|
Where can i find a good article about c# and exchange server. I need to programmically delete email in a particular mailbox and other possible functions.
Please help
|
|
|
|
|
|
Ohh ... i just review your link and i don't think that would be my purpose. My application will send a email into serveral mailboxs and if those users click a submit button on that emails and successfully postback to the server page, these emails has to be automatically removed (controled by my script) from their mailboxs .
I know there are so many DLLs and implementation i can use, such as WebDEV, CDO, or etc, but i need a good starting point ...
Thannk you
|
|
|
|
|
http://www.cdolive.com[^] is a good resource for everything about client and server side CDO.
_________________________________
Please inform me about my English mistakes, I still try to learn your language!
|
|
|
|
|
Hello All,
I select a Data from my databae and saved in the dataset i need to insert in this dataset new row at spacific position with the method InsertAt()
myDataSet.Tables[0].Rows.InsertAt()
Please help with example
Regards,
Hay
|
|
|
|