|
Aha! This does work. Now I must go search out what this actually is doing. Thanks much for your help!
c
|
|
|
|
|
Hi all. I am developing application using vs2005 and mysql5.0. The problem is I want to store date as dd/mm/yyyy which mysql doesn't allow me to store. Please suggest a way how to do that? I will be very thankful to you.
|
|
|
|
|
fahiemulleh wrote: mysql doesn't allow me to store
Databases store dates in binary form. What you refer to is the output or display or "formatting" of the date after you obtain the date information from the database.
led mike
|
|
|
|
|
so Please tell me How to format date (for display) as dd/mm/yyyy.
|
|
|
|
|
fahiemulleh wrote: so Please tell me How to format date
They hide that information in the documentation[^]
led mike
|
|
|
|
|
I think you are confusing the display format and the storage format. Most databases store datetime as a numeric value, tipically milliseconds since some starting date/time. How that date gets formatted for display is up to your UI code. if your locale settings are not appropriate for the dd/mm/yyyy display format, it likely can't reliably covert that string to a datetime. Since you are using ADO.Net, you should just use a parameterized insert/update query, and provide the date as a DateTime value, rather than a string. If you want to accept that format from your UI , just specify an appropriate IFormatProvider and DateTimeStyle to the DateTime.Parse method.
|
|
|
|
|
I have created MDI Form. Now inside the Child Form i have button and when the button is clicked i want to display another form and hide the current one.
How can i do this ???
|
|
|
|
|
Errm - create the new form and show it, then set the .Visible to false on the current one?
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi
u need to write this code in Button click event.
this.Close();
requiredForm.Show();
regards,
Rahi
|
|
|
|
|
I have done this but still no result. I am currently in index.cs file and want to access StudentArea.cs. Beside Student_Area button code in index.cs file i have wrote the code according to your method and get the following error.
"C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\online_exam_csharp\index.cs(119): An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Show()'
"
|
|
|
|
|
hi,
can u send me the exercise what exactly do u want to code?
is it correct: just u have 2 forms page1 and page2
u have one button on page1. when u click on button, the control should move to page2 and page1 should be unloaded.
if not, please try to send me the problem, so that i can write the code and send it to u.
Regards,
Rahi
|
|
|
|
|
Hello Ashraf,
Suppose you have 1 MDI Parent form which is "MAIN" and two mdi child forms which are "child1" and "child2"
In form child1 there is a button for opening child2 form and close child1 form, try this code
child2 objchild2=new child2();
this.hide();
objchild2.show();
|
|
|
|
|
hi,
You can do this by just overriding the constructor of the form that you want to open the last. In overriding the constructor put in it as an argument an instance of type first form (the one that contains the botton). For example, let us say that the last form to open is lastForm and the first one is firstForm.
You write the constructor of lastForm as follows:
public viod lastForm( firstForm first )<br />
{<br />
<br />
InitialyseComponent();<br />
first.dispose();<br />
}
and when calling the last form through the botton, you initialyze a new form and give it as an argument a reference to the current form:
private void button1_click( sender object, e )<br />
{<br />
lastForm last = new lastForm(this);<br />
last.show();<br />
<br />
}
hope it helps
Jamil Abou Khalil
|
|
|
|
|
you have to put following code behind the button against which you want to...
this.hide();
NewForm nw = new NewForm();
nw.ShowDialog();
nw.Activate();
nw.Close();
it is a well experienced code and u should not face any problems.hope your question is answered!
regards
ShaZ JazZ
|
|
|
|
|
I'll start my problem description off with some sample code which will probably do the best job at illustrating the problem.
using System;<br />
<br />
namespace TestCustomTypePropertySetValue<br />
{<br />
public class CustomThing<br />
{<br />
public CustomThing(string input)<br />
{<br />
m_input = input;<br />
}<br />
<br />
public string Input<br />
{<br />
get { return m_input; }<br />
}<br />
private string m_input;<br />
<br />
public override string ToString()<br />
{<br />
return this.Input;<br />
}<br />
<br />
public static implicit operator CustomThing(string input)<br />
{<br />
return new CustomThing(input);<br />
}<br />
<br />
public static implicit operator string(CustomThing thing)<br />
{<br />
return thing.ToString();<br />
}<br />
}<br />
<br />
public class ClassWithThing<br />
{<br />
public CustomThing Thing<br />
{<br />
get { return m_thing; }<br />
set { m_thing = value; }<br />
}<br />
private CustomThing m_thing = new CustomThing("default");<br />
}<br />
<br />
class Class1<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
CustomThing thing = "test custom thing input";<br />
<br />
string input = thing;<br />
<br />
ClassWithThing cwt = new ClassWithThing();<br />
System.Reflection.PropertyInfo propInfo =<br />
cwt.GetType().GetProperty("Thing");<br />
<br />
propInfo.SetValue(cwt, "test input", null);<br />
}<br />
}<br />
}
The last line in my sample code (PropertyInfo.SetValue) throws the exception "Object type cannot be converted to target type." If you run the sample code, you might notice that the SetValue doesn't even call the implicit conversion from string to CustomThing.
I'm getting this exception in code where I don't know the type of the property that I'm calling SetValue() on, and I'd rather not have to hack in a check for my custom type. Does anyone have any ideas on how to do this?
|
|
|
|
|
Matt Casto wrote: If you run the sample code, you might notice that the SetValue doesn't even call the implicit conversion from string to CustomThing.
That's because SetValue uses Object type for the value.
Try adding an implicit conversion from Object to CustomThing.
- Xint0
|
|
|
|
|
Xint0 wrote: Try adding an implicit conversion from Object to CustomThing.
I already thought of that, but it doesn't even compile because you can't have a user-defined conversion to or from the base class, so object is definitely out for that.
|
|
|
|
|
i need help steganography that how it is implemented in audio/video files? what technicquies are applied? and what algos are used
Musharaf
|
|
|
|
|
Did you look at the articles[^] here on CodeProject on the subject?
led mike
|
|
|
|
|
Corinna John has written extensively on steganography. See: articles[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hello all,
I'm trying to multiply a ComboBox Value with a TextBoxValue. The ComboBox items are a mix of decimal numbers and normal numbers. ( e.g. 10 , 19.5 , 21.2 , etc. ) and the TextBox Values are random numbers put in manually. I convert the Textbox Value using the Convert Class.
double no = Convert.ToDouble(this.textBox.Text);
That works, no problems there. The problem however, is converting the ComboBox Value.
double btwvoor = Convert.ToDouble(this.comboBoxBTW.Text);
This will throw an exception ( Input string was not in a correct format )
I'm pretty puzzled at this stage. Basically the ComboBox is of the same value type as the textbox ( which are decimal numbers )
Can someone point me in the right direction, and tell me what I am doing wrong.
Kind regards,
Rick
|
|
|
|
|
Rick van Woudenberg wrote: tell me what I am doing wrong.
I can tell you that it works when I do it. Both with values already in the ComboBox or when I type one in. Perhaps your code executes before an item is selected or entered in which case the .Text is empty?
led mike
|
|
|
|
|
Hello Rick,
Convert.ToDouble and Double.Parse will throw that exception when the input
is either invalid (unexpected characters) or empty.
So check the content of this.comboBoxBTW.Text
If you want empty to mean zero, that will take extra code.
Luc Pattyn
|
|
|
|
|
Thank you so much for replying quickly and accurate to my message. I appreciate it very much. I took all the anwsers and applied them to my code with a little hesitation because I couldn't see anything wrong my my initial code. What I found puzzled me even more.
I'm coding this application at work, on a laptop which my boss very generously donated. When I come home at night, I copy the code over to a PC and continue to work ( if I feel i like it ). When I run this code on my PC , it runs perfect. It only fails on the laptop. I have never seen this behaviour before, and I run C# Visual Studio on both machines. I think my laptop is ready for a rebuild
|
|
|
|
|
Is it possible that those two PCs have different culture-specific OS versions with different decimal seperators ('.', ',')?
I'd lost almost a day once, when I was searching for an error that only occured on my english work pc but not on my german home machine. To get around this I used overloads that take an IFormatProvider implementation and passed in a fix CulturInfo object.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|