|
If it is only one value you are fetching than you can use ExecuteScalar on the SqlCommand object. But I think ExecuteReader should also work.
|
|
|
|
|
SELECT MAX(MyColumn)<br />
FROM MyTable
You can then use ExecuteScalar() to read the value.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi all,
I have a textbox in Form1, where the user of the mentioned program is going to enter his name.
Then I have another Form (Form2) in which I would like to display the name of the user by getting it from Form1.
I am using MDI.
Can I do it? If so, can you help me please!
Thanks a lot for your help
|
|
|
|
|
Either make the textbox in form 1 public, or define a property or function that's public to return the entered text. Then in form 2, you will be able to access it via the form 1 object.
If you do not have a reference to the form 1 object in form 2, you won't be able to do that though.
- Dy
|
|
|
|
|
|
:-> Thanks for plugging my article
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hello
Let me help you about this public problem.
1.in Form1 go to code view page (press F7)
2.change below definition of textBox1:
private System.Windows.Forms.TextBox textBox1;
To :
public static System.Windows.Forms.TextBox textBox1;
3.now if you build your project you got some errors as :
...cannot be accessed with an instance reference; ...
and you should change all "this.textBox1" to "Form1.textBox1" like :
this.textBox1 = new System.Windows.Forms.TextBox();
change to :
Form1.textBox1 = new System.Windows.Forms.TextBox();
3.go to Form2 and where you want to access Form1's textBox1 just use this :
MessageBox.Show (Form1.textBox1.Text);
Easy...
mail me if you have problem yet
-- modified at 11:14 Monday 8th May, 2006
|
|
|
|
|
freshonlineMax wrote: change below definition of textBox1:
private System.Windows.Forms.TextBox textBox1;
To :
public static System.Windows.Forms.TextBox textBox1;
Why make fields in a class private, why not make them public?[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Look up the Model View Controler design pattern. Views should not know about each other. Forms are Views in this case.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi folks,
does anyone here know how I can detect if a program is running in full screen mode or not. I need my app to know this so it can suspend doing what its doing untill normal screen is resumed... It is the same is when your msn messenger goes into away mode when your playing a game etc. I have scoured the net and cant seem to find an answer anywhere
Any help is greatly appreciated
|
|
|
|
|
Hi All,
I'm creating a multi-threaded application where I'm spawning a new thread from the main thread. I've to execute the child thread once the main thread finishes its execution. I cannot put the code of child thread inline to the main thread as the thread does some work that I do not write code for. Once the main thread finishes doing everything the child thread execution starts.
I was wondering if there is something like Thread.Idle (like Application.Idle) event so that i can start the execution of the new thread. Or is there a better way to accomplish this.
An help will be deeply appreciated
TIA
Pavan K Kulkarni
|
|
|
|
|
|
I can't do that because I do not know when exactly the main thread finishes its execution. I want this to happen automatically...that was my question.
Pavan K Kulkarni
|
|
|
|
|
Hello everyone
I am trying to start a windows application at a specified time from a windows service, i am calling
System.Diagnostics.Process.Start(Filepath),
although the program starts when i saw it in the task manager but it does not show its form. i have also tried
System.Diagnostics.Process.Start("cmd", "/c \"" + Filepath + "\"")
but it opens a command window with my application which i dont want to open. is there any other function.
Shajeel
|
|
|
|
|
You can start the process, but windows service can't have window. A solution can be window application (form) that appears invisible all the time.
|
|
|
|
|
Basically i want to stop a running application made some changes to it, and then restart it from the service.
Shajeel
|
|
|
|
|
I have a datagrid with checkbox column. how can give access to user select only one check box at a time.
|
|
|
|
|
And which kind of application is? windows form or web
|
|
|
|
|
Windows application using C#
|
|
|
|
|
Why do you need to use a check box? This type of functionality should be done with radio buttons.
Roy.
|
|
|
|
|
I’m using a third party ActiveX control in my .NET Application. I manage to handle the callback in unmanaged C++ like this:
class MyCallback : public ICallback<br />
{<br />
…<br />
void OnComplete() {…}<br />
}<br />
<br />
…<br />
MyCallback *callback = new MyCallback();<br />
someobject->SomeFunction("just a string", callback);<br />
The function OnComplete is apart of the ICallback interface.
In C++ the method OnComplete will be called some seconds after SomeFunction has been called.
How do I translate that into C#?
I’ve come this far:
public class MyCallbackSC : ICallback<br />
{<br />
…<br />
void OnComplete() {…}<br />
}<br />
<br />
…<br />
MyCallback callback = new MyCallback();<br />
someobject.SomeFunction("just a string", (object)callback);
My C# program compiles fine but when I got an exception on the codeline above that says: InvalidCastException.
Anyone got any ide how to handle callbacks in C#...?
_____________________________
...and justice for all
APe
|
|
|
|
|
If i have several dll's in my solution
Is it then possible to include them in my EXE file, instead of them flooding my launch directory?
I dont want to put them in the gac or anything. Just want them included in the EXE file somehow..
Kind Regards
CS
|
|
|
|
|
Make search on word "obfuscator"
|
|
|
|
|
ILMerge[^] might be what you are looking for.
|
|
|
|
|
i want to implement SSL in my web project..but getting error ..as when i teried to upload the certificate on the web server .it is giving me error of wrong key .. can any one who has implemented this help...? my IIS version is 5.0 and using verisign's trial SSL certificate
|
|
|
|