|
Create a stored precedure that does the backup and execute it from the code
|
|
|
|
|
hello,
i have to use a component to extract exif data from jpg and tif files in my application. everything works fine so far. the component returns apex values as strings (formatted as fractions), e.g. 5000/100 for ShutterspeedValue or 227/32 for FocalLength.
i've read in the EXIF spec that there are quite difficult formulas to be used to calculate the real values. since i'm not a math-genius i'd like to ask if someone has done this already and can point me to some c# snippets.
i'm pretty desperate on this one and appreceate any help. thanks in advance.
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
Hi,
How can I validate the NumericUpDown value while it is being entered and prevent input?
For example if the max = 10 and min = 0 I would like the input of
11 to remain 1.
At validation the value vould become 10.
Regards
TooDoo
|
|
|
|
|
Web or Windows? If web, you need to write some javascript to validate it as it is being changed. Windows, handle the lost focus event.
only two letters away from being an asset
|
|
|
|
|
Try this:
private void textBox1_KeyDown( object sender, KeyEventArgs e ) {
if ( e.Control ) {
switch ( e.KeyCode ) {
case Keys.X:
case Keys.C:
break;
default:
e.SuppressKeyPress = true;
break;
}
} else {
switch ( e.KeyCode ) {
case Keys.NumPad0:
case Keys.NumPad1:
case Keys.NumPad2:
case Keys.NumPad3:
case Keys.NumPad4:
case Keys.NumPad5:
case Keys.NumPad6:
case Keys.NumPad7:
case Keys.NumPad8:
case Keys.NumPad9:
case Keys.D0:
case Keys.D1:
case Keys.D2:
case Keys.D3:
case Keys.D4:
case Keys.D5:
case Keys.D6:
case Keys.D7:
case Keys.D8:
case Keys.D9:
case Keys.NumLock:
case Keys.Left:
case Keys.Right:
case Keys.Back:
case Keys.Delete:
break;
default:
e.SuppressKeyPress = true;
break;
}
}
}
private void textBox1_KeyPress( object sender, KeyPressEventArgs e ) {
Int16 num;
if ( Int16.TryParse( textBox1.Text.Trim() + e.KeyChar.ToString(), out num ) ) {
if ( !( num <= 10 && num >= 0 ) ) {
e.Handled = true;
// Handle the key press event and display nothing.
}
}
}
If it is a windows application.
I'm listening but I only speak GEEK.
|
|
|
|
|
Hi again,
If I enter a value greater than Max, I can by having keyUp event, get the NumericUpDown to validate efter each input but the value and text is reset to a valid value before I get to know what the nonvalid value actually was or even if the entered value was not valid.
Can I get the actual value before it is reset or get an indication that the value is reset?
Regards,
TooDoo
|
|
|
|
|
In the KeyPress Event the value would be e.KeyChar as a char datatype or e.KeyChar.ToString() for a string datatype.
I'm listening but I only speak GEEK.
|
|
|
|
|
Hi again,
by that I get the just entered char but and to check the total value I have the merge the already entered value and the just entered concidering position also.
But for a very short time before the value out of range is set to Max/Min you get to see the total value added. Can't I get it somehow?
Regards,
TooDoo
|
|
|
|
|
OK, then move the KeyPress code to the Validating Event and alter the following:
if ( Int16.TryParse( textBox1.Text.Trim() + e.KeyChar.ToString(), out num ) ) {
TO
if ( Int16.TryParse( textBox1.Text.Trim(), out num ) ) {
Make sure take the Textbox Property CausesValidation = true;
I'm listening but I only speak GEEK.
|
|
|
|
|
Dear All,
I want to add menuitems at run-time. If I use a menu, I can use the following method :
menuItemFile.MenuItems.Add(0, new System.Windows.Forms.MenuItem("-"));<br />
foreach (FileInfo XmlDescriptorFile in XmlDescriptorFiles)<br />
{<br />
try<br />
{<br />
blah blah ...
Is there a way to do exactly the same thing with a MenuStrip ?
Cheers,
|
|
|
|
|
DropDownItems.Add(...)
led mike
|
|
|
|
|
I can't for the life of me get this to work. My internet crawl has produced nothing.
Executing this code:
<br />
using (StreamReader sr = new StreamReader(f+"\\CDINDEX.txt"))<br />
{<br />
string line;<br />
<br />
while ((line = sr.ReadLine()) != null)<br />
{<br />
Console.WriteLine(line);<br />
}<br />
}<br />
I get the following exception: " The given path's format is not supported."
Using a messagebox the path clearly reads: "c:\test\CDINDEX.txt" which is the correct and true path to the file.
Can anyone help me as to why for some reason Microsoft decided today not to like me?
Thanks.
|
|
|
|
|
Lordveralix wrote: using (StreamReader sr = new StreamReader(f+"\\CDINDEX.txt"))
go with
using (StreamReader sr = new StreamReader(f+"\CDINDEX.txt"))
Hope it is the error.
Regards,
Satips.
|
|
|
|
|
The reason \\ is used is because \ denotes an escape sequence like \t or \n. A double slash \\ allows a slash. Using just \CDINDEX.txt returns an error for invalid escape.
|
|
|
|
|
There's a bunch of useful methods in System.IO.Path to make sure your path is correct. I'd use Path.Combine() just to be sure in this case...
Standards are great! Everybody should have one!
|
|
|
|
|
Try
string MyPath = f+"\\CDINDEX.txt";
Put a break after this and look at the value of MyPath. I would hope there would be some obvious error, but if not then copy the value and put it in the command prompt and make sure it works.
topcoderjax
|
|
|
|
|
What is f?
Could you quickly try
<br />
using (StreamReader sr = new StreamReader("C:\\test\\CDINDEX.txt"))<br />
instead?
Arti
|
|
|
|
|
Like Bekjong said, the correct way to put a path together would be to use the Path class and it's Combine method:
string filepath = Path.Combine(f, @"CDINDEX.txt");
using (StreamReader sr = new StreamReader(filepath)
|
|
|
|
|
I have added a group of controls to a form using code and added the controls to the form collection.
How can I later iterate through all of the controls on the form and drop the (Textbox) controls that I added earlier?
I can use a property in the control to do the ID, but I need code to iterate through all controls, and to drop selected controls.
A code sample would be great!
Joseph Stanish
|
|
|
|
|
The easiest way to remove a control is to keep the reference from when you created it, and use use the Remove method:
SomeParent.Controls.Remove(SomeTextbox);
---
single minded; short sighted; long gone;
|
|
|
|
|
(I guess I could dim a collection of textboxes and add each of my textbox controls to this collection, and then when it is time to remove these controls go throught this collection and drop the controls form the form ...
Is the correct?
That sounds like a very good idea! Could you please provide a brief code sample?
Joseph Stanish
|
|
|
|
|
What's so hard about iterating through your controls? If you can add the pro grammatically it's just as easy to remove them, isn't it?
this.SuspendLayout();
Collection<Control> temp = new Collection<Control>();
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(TextBox) && c.Tag == "drop me")
{
temp.Add(c);
}
}
foreach (Control c in temp)
{
this.Controls.Remove(c);
c.Dispose();
}
temp = null;
this.ResumeLayout();
Standards are great! Everybody should have one!
|
|
|
|
|
Perfect. Thanks.
Joseph Stanish
|
|
|
|
|
Hello,
Very nice idea to copy the instances in a seperate Collection instead of Cloning the Collection!
Never thought of this bevor!
Thanks for that!
All the best,
Martin
|
|
|
|
|
Bekjong wrote: if (c.GetType() == typeof(TextBox)
or better yet
if (c is TextBox && ... )
|
|
|
|