|
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
|
|
|
|
|
Judah Himango wrote: // I sure hope the database guy doesn't change the stored proc name, or I'll be screwed!
Judah Himango wrote: // I sure hope the database guy doesn't change this stored proc parameter, or I'll be screwed!
Judah Himango wrote: // I sure hope the DBA doesn't modify the return type, or I'm screwed!
It sounds like the problem is more to do with team communication rather than ADO.NET. Would you like to suggest a way of working where your code would not be screwed by someone changing the stored procedure name, the parameters or the return type?
Judah Himango wrote: // Oh, great, boxing! Thanks ADO.NET!
How would you suggest it is done? Given the roundtrip time of calling a stored procedure on a database the additional time it takes to box this value is negligable. When running a SQL Command you have much greater performance problems to worry about than that piddling little thing.
Judah Himango wrote: All this for calling a single stored procedure! And refactoring -- refactoring is tedious because all the code is strings.
I write a DAO (Data Access Object) class to wrap this up neatly. Most of my public methods are just one or two lines long. All the rest is common enough to be sent to private methods to be called from the public one.
I've also experimented with using reflection to work out what should be built as I use a cradle-to-grave naming convention and my DAO class acts as a proxy to the stored procedures, so its public interface is basically a C# representation of the stored procedures.
Judah Himango wrote: 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.
I've not yet found a code gen tool that solved more problems than it created.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Colin Angus Mackay wrote: Would you like to suggest a way of working where your code would not be screwed by someone changing the stored procedure name, the parameters or the return type?
Sure: a tool that statically analyzes my code and the database code, making sure it's all synced and compatible. Or at very least, a tool that could generate ADO.NET code given a stored proc, view, etc. so that if major changes are made, it would just regenerate ADO.NET code to make it all work nicely again. My C# code would then fail at compile-time, rather than at run-time.
Colin Angus Mackay wrote: When running a SQL Command you have much greater performance problems to worry about than that piddling little thing.
Ha, that's true, but if you put this on a server where thousands of sprocs are being called, this contributes to more garbage collection, degrading performance. I would suggest a generic class for this; after all, most sproc parameters are value types (come to think of it, the only time I use reference types would be when dealing with text or binary data). I suppose some of the marshalling and casting to get this to work might offset the benefits, if it's at all technologically possible.
|
|
|
|