|
The "nothing" problem was that the first textbox would not update with any text. After fiddling around with the code and recompiling- not really changing anything- everything magically works now. I had this experience with classic VB and ASP. Sometimes things just don't work- then later would work. You scratch your head for hours wondering what the heck you are overlooking. Since i am new to C# i was not sure if the problem was me or the microsoft IDE. I guess i am going to have to get in the habit of recycling the computer power when i run in "mysterious" circumstances again. This is one way to overcome these glitches. FYI, i am using visual studio 2003.
But thanks very much for confirming that i did good. I posted this question on some other forums and got ZERO response. Your help allowed me to rule out "me" as the problem.
|
|
|
|
|
|
You may try this.
private void Form_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.F12)
{this.button1_Click(this, null);}
}
"I am a lair" Is this statement true or false ?
|
|
|
|
|
I was stumped by this too, but the answer is simple. Assign the Shortcut property of a MenuItem. This means you need a Menu obviously.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
I've got that functionality on a a few larger dialogs, but I wanted help to be F1 even on the small modal ones. LongHC gave exactly want I wanted though.
|
|
|
|
|
Hi All
I have some application that i need to get parameters from the user and open Windows Form in the size that this user choose.
How can i change Windows Form in the run time ? [real time] ?
Thanks.
|
|
|
|
|
If you are changing the parent form then use:
this.Size = new Size ( width, height );
if you are opening a new window then:
Form form2 = new Form();
form2.Size = new Size(300,300);
|
|
|
|
|
Modify the Size atribute.
To have a form resize itself do this:
this.Size = new Size(width,height);
You'll need to look into anchoring (or possiby docking) your controls to grow/reposition them when the form changes it's size. If you're using 05 you could also try the layout manager. In 03 for anything complex you might have to handle the resize event yourself.
|
|
|
|
|
I have a large project that early on a class was defined as "Blocks". There was grandious plans for this class, but as the project developed, "Blocks" became a place for a few constants. I would like to change this "Blocks" to "Constants", but the term "Blocks" is used EVERYWHERE in the program. The only certainty is that if I did a simple search and replace, I would screw at least 100 things up. I heard a rumor there is a smart replace for variable names/etc. I found very little info on it. Has anyone used it. Does anyone know if it will work on classes.
Thanks in advance...
Dwayne
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
If you're using VS2005, it supports refactoring[^]. If not, there are tools available for previous versions of VS, such as this one: ReSharper[^]. I am not aware of any free tools, though truth be told I have never looked for them.
Jon Sagara
As you may presently yourself be fully made aware of, my grammar sucks.
Sagara.org | Blog | My Articles
|
|
|
|
|
Refractoring is the rumor I heard about. I am using 2003... Any thoughts on switching to 2005 mid project??? shouldn't be any issues right???
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
It's hard to say, and only you and your team can make that call, but my gut reaction is that if you just want the refactoring, then no, don't switch mid-project.
Jon Sagara
As you may presently yourself be fully made aware of, my grammar sucks.
Sagara.org | Blog | My Articles
|
|
|
|
|
You could use "manual refactoring". Just rename the class and compile. The list of compile errors are references to everywhere you use the class. Double click an error and you end up in the file with the name selected. Just paste in the new name.
---
b { font-weight: normal; }
|
|
|
|
|
I have stored my PDF files in the database as binary code.
Now i want to retriee the the binay format file and want to display to my user.
But when ever i have tried the file is not visible. Why? Any help..
Your help highly appriciated!I have written below code..
Basically i want to show the report to the user, I like to store in memory rather physically storing the report in hard drive.
Or do we have any better way to display the report to my user from database (But constraint is File should show in PDF format only!)
string strString= "Select Image From ImageTable where ID=1"
SqlConnection connection = new SqlConnection(connectionstring);
connection.Open();
SqlDataAdapter da = new SqlDataAdapter(strSpName, connection);
da.SelectCommand.CommandType = CommandType.Text;
DataSet ds = new DataSet();
// Fill dataset
da.Fill(ds,"Image");
if (ds.Tables[0].Rows.Count > 0)
{
byte[] Myimage= new byte[0];
DataRow dr;
dr=ds.Tables["Image"].Rows[0];
Myimage = (byte[])dr["NoticeImage"];
int ArraySize = new int();
ArraySize = Myimage.GetUpperBound(0);
FileStream fs = new FileStream(@"C:\Temp\image.pdf", FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(Myimage, 0,ArraySize);
fs.Flush();
fs.Close();
File.Open(@"C:\Temp\image.pdf", FileMode.Open);
}
|
|
|
|
|
Does the file's size seem correct. if not then you may not be writing the bytes correctly.
|
|
|
|
|
The file is storing in C:\Temp\image.pdf with out any Issue. I can open the file manually.. Once i tried File.Open C:\Temp\image.pdf , file is not visible. I am not sure either we need to specify like Activate/Show. How can it is visible?
|
|
|
|
|
|
hello.
Use the following code snippets.
<br />
System.Diagnostics.Process.Start("string to your local path string retrieved from the database");<br />
I hope that will help.
Mess With The Best And Die Like The Rest
|
|
|
|
|
Hey
this is the code and than I will explain the WEIREDEST problem ever.
for(int cnt = 0 ; cnt < sWord.Length ; cnt++)
{
aLabel[cnt] = new Label();
aLabel[cnt].Text = "_";
aLabel[cnt].Location = new Point(30 + (cnt*10) , 200);
this.Controls.Add(aLabel[cnt]);
}
sWord is a member string which is length is 15.
aLabel[] is an array of Labels which has 15 slots. (the same length as sWord)
what I want to do is to put 15 "_" one after another with a space of 10px
between them. pretty simple, but for some reason, no matter WHAT I am doing, c# puts all the labels one over the other, at (30, 200)! I really don't know why its ignoring the (cnt*10).
I tried to do it all speratly, by creating a point object and an int variable, hoping it would help, but it doesnt...
I'm really out of ideas.
Help anyone???
THANKS!
|
|
|
|
|
What I see here is that the for loop could throw an out of bounds exception.
rewrite:
for( int cnt = 0; cnt < sWord.length - 1; cnt++)
{...}
//this is because the length of a string is not base 0.
The second part about the label that is drawn in the same location. Can you post that code? From whats posted here I cannot identify the problem.
have you tried to step through the debugger looking at each label's location to see if its properly created?
try setting the x,y values for your point to variables and set the variables before setting the location of the label.
|
|
|
|
|
KaptinKrunch wrote: What I see here is that the for loop could throw an out of bounds exception.
there is no mistake because I used "<" and not "<=".
the aLabel[] goes from 0 to 12
sWord.length is 13.
12 < 13 - thats the final step, on 13 < 13 it will snap out of the loop.
KaptinKrunch wrote: The second part about the label that is drawn in the same location. Can you post that code? From whats posted here I cannot identify the problem.
thats pretty much the whole code, I just declared the sWord string member and created the aLabel array, THATS IT!
KaptinKrunch wrote: have you tried to step through the debugger looking at each label's location to see if its properly created?
thats what makes everything even more confusing! the debugger shows that the right values are entered!
KaptinKrunch wrote: try setting the x,y values for your point to variables and set the variables before setting the location of the label.
did that too!
when I enter the location to each one of the labels WITHOUT using "cnt", but using ONLY number, everything works great! but I can't use that in my program because I do not know how many labels should be formed.
This is a really weird problem....
thanks alot for your help....
|
|
|
|
|
Add the line below.
aLabel[cnt].Width = 10; //set the width to something small or it defaults to 100 I think.
|
|
|
|
|
amazing!
I would have never thought of that!
I thought about the width, but I didn't think its THAT big!
thanks!
|
|
|
|
|
Hi~
I am trying to solve an unusal problem. I am working on exception handling in my application (.NET / C#) using Enterprise Library Con. from Microsoft and all was going well until I started working on the situation where the connection to the database is lost. Right now my problem is that in the ExceptionHandler I wrote for this specific case needs to show the user a MessageBox and when I hit the MessageBox.Show("errorMsg", "Connection Error", MessageBoxButtons.YesNO, MessageBoxIcon.Information) I get the JIT exception (quit or continue). I have tried moving the messagebox out of the handler and still get the same error. The other ExceptionHandlers I have created have no problems displaying message boxes - however the database connection is still in place. - Side note - If I force a throw of the kind of exception I am looking for, but do not actually stop the database the message box works fine
Dazed and Confused
Michele
Mercer Engineering Research Center
mstusak@merc.mercer.edu
|
|
|
|
|
Sounds like the exception is being thrown from a location your not expecting, thus never executing your messagebox.
|
|
|
|