|
puneet.bhatnagar123@gmail.com wrote: http://www.codeproject.com/KB/cs/C__Reflection_Tutorial.aspx
That article has a discussion board. Consider posting your question there with a neat subject.
|
|
|
|
|
puneet.bhatnagar123@gmail.com wrote: Type Objtype = Type.GetType("Login");
Please go read the documentation on MSDN, and what they say you need to pass into that function. You havent, and hence the error.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Way 3:
bSaveDone = new Login().Save(UserName, Password, objForDBTransactions);
Have you actually sat down and thought about why you are using generics and reflection to achieve some very simple tasks?
|
|
|
|
|
Hi,
Thanks for the way3. I have already tried with that and that was working fine for me. The reason why I am using Reflection and Generics is because we gonna use these two concepts in our next project which still is in design phase. So just to learn I am using them.
Thanks for your efforts.
Thanks & Regards,
Puneet
|
|
|
|
|
Ok, in that case:
Generics in type specifications are usually done like so: Type`1[Generalisation] so like System.Collections.Generic.List`1[System.String].
I'd go out on a limb and suggest that Save`1[System.String] will work for you. Otherwise, you'll have to read the docs more.
|
|
|
|
|
Hi,
Thanks a lot sir. I will try your solution and will definately read some more stuff on Reflection and Generics.
Once again thanks for your efforts and time.
Regards,
Puneet
|
|
|
|
|
Hai all,
In my application i am trying to convert my wmv file into swf file format. And its working on Command prombt very well and it created the output file also.
But when i write the code in c# (below mentioned) its not working. But no more errors or exceptions arise. But No outputs found(no new.swf file was created).
filargs = "ffmpeg -i d:\\hai.wmv -s 480*360 -deinterlace -ab 32 -r 15 -ar 22050 -ac 1 d:\\hai.swf";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName ="D:\\ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = filargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitforExit(50000);
Thanks and regards...
Sham
|
|
|
|
|
shanmugam81 wrote: proc.WaitforExit(50000);
Dont do that!
Also provide a current working directory, else where would the output file end up?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hi to all,
In MSVS 2008 Documentation, (System.Windows.Forms) Application.ThreadException Event there is an example how to handle unhandled exceptions using:
Application.ThreadException += new ThreadExceptionEventHandler...
and
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
But, there is a caution that says:
"Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result."
So, the problem is that I'm not sure WHERE to detach these handlers. If someone knows the answer, please share this knowledge with me!
Thank you in advance,
Matix
|
|
|
|
|
I haven't tried, but I think this will do the trick
Application.ThreadException += ThreadExceptionHandler;
Application.Run(new Form1());
Application.ThreadException -= ThreadExceptionHandler; Application.Run blocks until application exits.
|
|
|
|
|
In case that some kind of unexpected error occurs inside Form1, if program execution transfer to our Exception handler, and handler EXIT application (because some kind of fatal error has occurred), does program executes code after "Application.Run(new Form1());"???
|
|
|
|
|
Well, wrap it in a try finally blocks
Application.ThreadException += ThreadExceptionHandler;
try{
Application.Run(new Form1());
}
finally{
Application.ThreadException -= ThreadExceptionHandler;
} finally block will execute always.
|
|
|
|
|
I'm not sure that's needed -- if an exception is thrown by the app and not handled, it's going to hit your error handler anyway.
I may, of course, be wrong.
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
Correct. But we were talking about detaching event handler when application ends. So I think finally is required.
|
|
|
|
|
The operating system is perfectly capable of cleaning up when your process exits.
Actually, .NET will already clean up all objects (including the event handler) when the AppDomain shuts down.
It only makes sense to explicitly detach the event handler when your application doesn't shut down but you still want to free the memory used by the exception handler.
|
|
|
|
|
Daniel Grunwald wrote:
The operating system is perfectly capable of cleaning up when your process exits.
It's perfectly clear, but, why MSVS documentation caution me that I " must detach your(mine) event handlers when your(my) application is disposed, or memory leaks will result."
matix
|
|
|
|
|
You could unload only the AppDomain that caused the exception, for example.
|
|
|
|
|
Hi All,
I want to paste only valid value(like numeric value) in textbox through mouse(right click) and keyboard(Ctrl+V).
Thanks in advance.
|
|
|
|
|
Have you tried anything yet?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
No, I do not understand how to do it?
|
|
|
|
|
|
Handle the TextChanged event.
Even better, use a NumericUpDown control.
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
override WndProc, trap WM_PASTE and process there. Check out pinvoke.net.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks, but I don't know how to use this. Please give me a little example.
|
|
|
|
|
OK. This example creates a customized TextBox so add this class, build then drop onto a form.
public class RestrictedTextBox : TextBox
{
private const int WM_PASTE = 0x0302;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PASTE)
{
if (!IsPasteValid())
{
m.Result = IntPtr.Zero;
return;
}
}
base.WndProc(ref m);
}
private bool IsPasteValid()
{
bool rtn = false;
IDataObject obj = Clipboard.GetDataObject();
string pasteString = (string)obj.GetData(typeof(string));
return rtn;
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|