|
Is it ON the return from InitializeComponent() or after (like when the constructor is exiting). Do you have a destructor (or similar) performing some type casting?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
It is inbetween the return from the contructor and empty space..the debugger goes to the //TODO...comments first line and the very next step I get an invalid cast operation. I think I may just wipe it and start a new form.
Thanx for the help though!
Jude
|
|
|
|
|
TheJudeDude wrote: the debugger goes to the //TODO...comments first line
This is not possible. Something tells me that your source code is not in sync with the compiled code.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I don't know...it happened, but I rebuilt th form, and now all is well. I appreciate the replys though.
Thank you
jude
|
|
|
|
|
hi guys,
i need to know if a process that im monitoring has exited.. im using c#, and a noob in using the Process class. for example, im monitoring MS word, i can tell if it starts but i can't catch the event, the moment it terminates... help pls..
|
|
|
|
|
Is there a way to find out the what the 'master volume' (the one on the Volume Control app) level is set to?
Thanks
|
|
|
|
|
Just found this
http://www.codeproject.com/useritems/AudioLib.asp
|
|
|
|
|
hi. i made a simple web browser. i want if i push 'Enter' button url must load.
in microsoft example i see^
void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
// Navigate if the ENTER key is pressed
if (e.KeyChar == '\r')
Navigate();
}
i re-made this for my project^
void webBrowser1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
this.webBrowser1.Navigate(toolStripTextBox1.Text);
but in 1st & second ezmples didnt work. please tell litle beginner how made this.
thanks for your help
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
if you want to capture the ENTER key, then thes if e.KeyCode == Keys.Enter
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
ok thanks i did it, but not work i compile without erors but nothink hepend when i push 'Enter' key. please look my code^
private void Form1_KeyPress(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
this.webBrowser1.Navigate(this.toolStripTextBox1.Text);
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
The if clause should work. Check in the debugger, if Form1_KeyPress is called, maybe you forgot to subscribe to the form.KeyPress event handler?
this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
I want to know how can i use the visual studio Query Builder I think it is in Microsift.VSDesigner assembly but I dont know how to use it.
Thank you for your help
|
|
|
|
|
Hi all,
I'm declaring a property...
<br />
public int Number ()<br />
{<br />
get <br />
{ <br />
return myInt; <br />
}<br />
set <br />
{ <br />
myInt = value;<br />
}<br />
}<br />
and I'm getting a build error. The complaint is coming from the get and set keywords, it is asking for a semi-colon (;) to be placed after each. I also believe that value should be a keyword (i.e. highlighted by the ide) which it is not.
Can anyone help because I thought this was pretty straightforward.
|
|
|
|
|
richiemac wrote: public int Number ()
Properties are declared without the brackets. The compiler thinks you're trying to declare a function.
Should be:
public int Number {
get {return MyInt;}
set {myInt = value;}
}
Share and enjoy.
Sean
|
|
|
|
|
public int Number
{
get
{
return myInt;
}
set
{
myInt = value;
}
}
try this.
|
|
|
|
|
Properties don't need brackets ( and ) in the method header
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks guys!
Knew it was something trivial.
|
|
|
|
|
I guess I'm missing something. I've designed a testbed app to help me learn C# (I come from a Delphi background) and I've got the menu set up. Plus I've added in the AboutBox form to my project. Now how do I open the AboutBox when I click on the Help|About... menu choice - what code do I stick in there to open AboutBox1? And then, once I've got the AboutBox open, what code do I put in at the Close button's Click event to make it go away?
In Delphi I'd just put in (on the main form's Help|About... Click procedure) the code:
AboutBox.Show;
Also in Delphi, I'd put in the AboutBox's Close button Click procedure the code:
Self.Close;
Can anyone give me a clue, maybe drop me a sample project at:
delphidb-AT-comcast-DOT-net
Derek Benner
|
|
|
|
|
In the Visual Studio dialog designer you can doubleclick on the menuitem, it will then generate the click code for you. You can then open the form like this:
AboutBox about = new AboutBox();<br />
about.ShowDialog();
Closing the form is easy as can be: Close();
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Okay. Tried that. Got it to work. Thanx!
One thing.
C# is *very* picky about them trailing Open and Close parens isn't it? '()'.
Derek
|
|
|
|
|
delphidab wrote: One thing.
C# is *very* picky about them trailing Open and Close parens isn't it? '()'.
Is this intended as sarcasm?
|
|
|
|
|
Not sarcasm, just an automatic response to an unexpected shock. Delphi doesn't require a procedure or function that doesn't need arguments to have the parens attached. You *can* but Delphi doesn't expect it and so most people don't waste their time typing them.
So either
Self.Close;
or
Self.Close();
are valid in Delphi.
Derek
|
|
|
|
|
delphidab wrote:
C# is *very* picky about them trailing Open and Close parens isn't it? '()'.
It's the same in C(++) and Java. All methods need parentheses regardless of whether they return something or not (void ).
But properties don't need parentheses.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yeah, well... This is my first exposure to C#. It's been almost 9 years since my last exposure to C/C++. And I've never worked with Java. I'm coming from Delphi. In Delphi, you didn't need to put in the parens if the procedure or function didn't expect arguments.
Derek
|
|
|
|
|
I'm not usually one to complain, but I'd like to say publicly that I despise writing SQL statements using C# strings. In fact, the whole ADO.NET model really stinks, very tedious and hugely error-prone.
I mean, calling a simple stored procedure with a few arguments is a royal pain:
SqlConnection connection = new SqlConnection(...);
string commandText = "MyStoredProcName";
SqlCommand command = new SqlCommand(commandText, connection);
SqlParameter param = new SqlParameter("@param1", [database type], [data type size], [source column]...);
param.Value = 5;
SqlParameter param2= new SqlParameter("@param2", ...);
param2.Value = someGuid;
command.Parameters.Add(new SqlParameter[]
{
param1,
param2
});
try
{
connection.Open();
object returnValue = command.ExecuteScalar();
return (int)returnValue;
}
catch(SqlException)
{
...
}
All this for calling a single stored procedure! And refactoring -- refactoring is tedious because all the code is strings. Error prone, and no way to catch it at compile time.
So I was hoping one of you might know of some tool that either generates code like this automatically, and/or checks for the validity of code against a stored procedure. Is there anything like this?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|