|
Two events to look at:
private void hsc_Scroll(object sender, ScrollEventArgs e) {
}
private void hsc_ValueChanged(object sender, EventArgs e)
{
}
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
This is the 5th version of the same question.
|
|
|
|
|
Hi, i would like to explain my problem. I want to see the code when my applcation generate an exception.
I create a simple application that crash when a button is pressed:
private void button1_Click(object sender, EventArgs e)
{
Int32 Text;
Object obj= null;
Text= (Int32)obj;
}
This code generate a NullReferenceException when it try to make a cast of "obj".
Now, i run .exe file on a pc with only VS2008,when i click the button,jitdebugger start and ask me where is the file .cs.
My questions are:
Why the jitdebugger ask me where is the .cs file?
If i open module page (ctrl+alt+u) i see my file .exe with symbols loaded, but i can see the c# code.
Help me please.
Thank you, have a nice day
bye bye
|
|
|
|
|
frommi wrote: Why the jitdebugger ask me where is the .cs file?
Did you actually create a deployment app or are you just copying the .exe from the bin directory to another computer? This will not work.
As for the error, you might want to try the following.
Text = Convert.ToInt32(obj);
This will run without creating an error.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Kwagga wrote: just copying the .exe from the bin directory to another computer? This will not work.
Sure it will. Debugging won't, but the app will (unless it throws an Exception ).
|
|
|
|
|
frommi wrote: Why the jitdebugger ask me where is the .cs file?
There is no global exception handler in your application. Thus, you're asked whether or not you want to debug the application. The debugger will ask for the code-files to point out where the exception occurred.
frommi wrote: If i open module page (ctrl+alt+u) i see my file .exe with symbols loaded, but i can see the c# code.
Symbols are provided by the .pdb file, and you'll only see the C# code when the debugger can find the appropriate source-code.
|
|
|
|
|
well, i create the Release version of my simple application and i copy all Realese folder, it contains:
CrashDebug.exe
CrashDebug.exe.config
CrashDebug.pdb
CrashDebug.vshost.exe
CrashDebug.vshost.exe.config
CrashDebug.vshost.exe.manifest
and i set in .config file
configuration
system.windows.forms jitDebugging="true"
configuration
The error is created for start the debug and see the code.
But i can't see that.
|
|
|
|
|
You can't see the code, because it's not physically there. It knows the name of the files by looking at the "CrashDebug.pdb" file. There it finds the name of your .cs file, and asks for it.
What were you expecting to see?
|
|
|
|
|
I expected to see the line code, like when i run application directly form visual studio IDE.
You are sure that is impossible to see the native code when it's crush and the JITdebug run for resolve the problem?
|
|
|
|
|
It's not impossible. You'd need the source-code against which the executable was compiled, otherwise the addresses in the pdb-file[^] will point to the wrong line. It's as easy as copying the source-files to the system where the exception is occurring.
That is, if that is your intention.
If you're wondering whether someone can decompile your code and look at the internals - then you're right. If it's your intention to stop that, then start with not distributing the pdb-file and check out the different code-obfuscators for .NET
|
|
|
|
|
hey guys.. i'm trying to make a comic strip creator application in c#.. it involves character creation so that the users can customize the characters that they want to put in their comic strip.. just imagine the character/avatar creator that we see in the internet.. that's what i'm trying to do.. my problem is that i don't know what approach am i going to use for this part of my program.. i tried using picture box and merging the combination that was chosen as a single image but i can't do it.. and i think that approach was wrong too.. this is my first time to make an application that involves image manipulation so i really need suggestions on how to do this..
and also, is it possible to insert images using the paint event??
|
|
|
|
|
strife19 wrote: and also, is it possible to insert images using the paint event??
Yes, I would recommend using the paint event and a panel.
So I am assuming you have a load of images (for each part of the character) that you want to effectively place on top of each other?
Create a number of Class Level Image Objects...
Image Hair;
Image Face;
Image Body;
Set the Images with whatever method you want, example...
Hair = ImageListHair.Images[2];
PanelMain.Invalidate();
Then in paint event draw them on the panel...
void PanelMainPaint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(Body, xPos, yPos, width, height);
}
...Hope that makes sense?
This is a very basic idea, you could, and probably should, have a Character class with properties for each of the different body parts and a method that draws the character by taking a Graphics object as a parameter.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
thank you for your suggestion.. i will try this approach right away and post whatever the outcome is..
|
|
|
|
|
Hi
I need to capture screenshots from DirectX games. I am using this code but sometimes I get totally blank images or the image of the desktop (but the game is open)
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
I really need help.
Thanks.
|
|
|
|
|
|
I have seen that code but I thought it was to use on your own DirectX application to save a screenshot of your own DirectX application.
Can you tell me how to use that code?
Thanks.
|
|
|
|
|
|
Thank you, I am looking into those links.
|
|
|
|
|
Please let the forum and I know if any of those helped; that way if the question comes up again we can reference those links.
Thanks!
leckey
|
|
|
|
|
None of those links worked.
|
|
|
|
|
Hi
I made a window service application and I used system.timers.timer class . I set timer interval from config file. I would like to fire timer as specified interval in config file. It works fine but while running the windows service I want to change timer interval in config file and timer should be fired at latest interval . When I stop the service and restart the service then timer fire as specified value in config file.
Pseudo code
private System.Timers.Timer timer2 = new System.Timers.Timer();
protected override void OnStart(string[] args)
{
// dblValue = 30000
double dblValue = Convert.ToDouble(ConfigurationManager.AppSettings.Get("Interval"));
timer2.interval = dblValue
timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Elapsed);
timer2.Enabled = true;
}
void timer2_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
timer2.Enabled = false;
// doing some operation
// Now I want to change the value in config file like dblValue = 60000
double dblValue = Convert.ToDouble(ConfigurationManager.AppSettings.Get("Interval"));
timer2.interval = dblValue
timer2.Enabled = true;
}
but timer always fired after 30000 milliseconds. But I want , timer should be fired after 60000 milliseconds , means latest value define in config file. Please tell me how to do this ?
Regards
Rajesh
rajesh
|
|
|
|
|
Its because config files are only read once and then cached.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Write your own config system and read it on each cycle.
Personally, I use a database for that.
|
|
|
|
|
Thanks.
I have created an xml file and stored interval . While running the windows service interval is set well through xml.
Regards
Rajesh
rajesh
|
|
|
|
|
Hello I'm beginner in c# and I'm working on a small application and my problem is that I have put a TextBox in my application form which I need to set a font a font that I have downloaded, it means that it's not in the C:\Windows\fonts directory, how I'm going to do please help me
Thank you .
modified on Wednesday, July 29, 2009 7:21 AM
|
|
|
|