|
It works but validate event fires first before closing event ? again message displays that "please enter user id and pass word".............? after this closing
How can i handle this event in button click???
|
|
|
|
|
Im trying to crontrol a Buttons Visablity on the main Form1..
I've searched all over the internet for help on this subject and couldnt find any soo I will post my question here
My Code:
if (blargh == verc)
{
Form1 f = new Form1();
f.btn_Start.Visible = true;
f.btn_Patcher.Visible = false;
}
else
{
Form1 f = new Form1();
f.btn_Start.Visible = false;
f.btn_Patcher.Visible = true;
}
}
|
|
|
|
|
Is this code in Form1 itself?
in which case you should have
this.btn_start.Visible = true;
|
|
|
|
|
No its in a special class that checks a binary stream..
its not part of Form1..
|
|
|
|
|
The button has to be declared "public" (or "internal" if you are in the same project and dont want other projects to be able to do the same). And this should work:
Form1 f = new Form1();<br />
if (blargh == verc)<br />
{<br />
f.btn_Start.Visible = true;<br />
f.btn_Patcher.Visible = false;<br />
}<br />
else<br />
{<br />
f.btn_Start.Visible = false;<br />
f.btn_Patcher.Visible = true;<br />
}<br />
f.Show();
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Thanks for trying Alex, that didnt work either.
|
|
|
|
|
That way *has* to work. You probably have some code that changes the visibility during the Load event or something. Or maybe you are using a different button implementation that has a bug.
You can try another way. Pass the value to the Form and then handle the Load event and do what you need.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi all,
I am able to find all the values tht are needed to draw a histogram (graph) of an image... but i don't know how to draw a histogram (basically a 2D plot) for it. I want to display the histogram (graph) on a seperate window, whenever i click on a menu button.
Plz... gimme me some ideas or suggestions on how to implement tht...
thanks in advance,
Suman
|
|
|
|
|
You have the values. Now just loop and use DrawLine(); Based on the value calculate so that you have a different line height. Increase your X value and continue for the next value.
If this doesn't work for you - you might end up having to use SetPixel method.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi,
i can understand ur code... but the problem is...
I have developed a Windows form Project in C# and in tht i am opening different bitmap images....now in tht when a bitmap is active and the user selects a menu button "Histogram"... i have to display the histogram of tht image in a seperate window. So i have to initialise a new window(form) and i have to display the histogram(plot), which i don't know how to do tht...
Hope i am clear now... if u have any ideas plz share with me...
thanks,
Suman
|
|
|
|
|
Hello all,
Tell me, what is Resource Gloablization? and how is it work? Give me example to it.
|
|
|
|
|
|
DirectShow.
in the other word how can i play multi-file once?
thanks!
|
|
|
|
|
Hi All,
I am connecting to a SQL 2000 Server database by using a datareader.
I am getting this error.
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
1. How can I lengthen the time out on my connection?
2. How can I make sure there are no connections and that all connections are released by me and returned to the pool?
Thanks for any help.
Stephen
|
|
|
|
|
It would help if you could provide us with some code, and where the exception occurs.
|
|
|
|
|
|
is there anything special that needs to be done when interopping with objects of type System.__ComObject? without good docs, how do you know what to cast to if all u got is a C# type object?
|
|
|
|
|
It greatly depends on what you're doing. All types (doesn't matter which language, BTW) are IDispatch implementations unless you expose an interface differently using different enums for either the InterfaceTypeAttribute<?code> (for interfaces) or <code>ClassInterfaceAttribute (auto-generated class interface; never use auto-generated class interfaces, though).
When you cast an object to a COM-defined interface (attributed with ComImportAttribute ) a QueryInterface is actually performed using the interface to which you're trying to cast. This means you have to have some idea of what you're trying to cast, otherwise you can either cast it as IDispatch (if it's a dispatch object) or - at the very least - IUnknown , which honestly gives you anything useful.
As I've told many people, understanding COM interop with .NET well requires that you understand COM well. I would recommend picking up a book on COM programming, as well as a book on COM interop if you need further explanation.
There's also several good articles here on this site that explain bits and pieces, but the bigger pictures requires a deeper understanding of just how COM works and how .NET interop works with (and for) COM.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I am trying to output a txt file to a Windows form in C# of course. I have coded how to read the file, that is not a problem anymore. And I can outpout it to the console. But I have been unsuccessful on how to output it on a Form instead of a console.
Can anyone help please?
A Newbie in tha block
|
|
|
|
|
Add a control (such as the Label or TextBox) to the form and set its Text property to the contents of the file.
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|
|
Thank you Alvaro for your response,
I am writing a program that reads records from a file of type txt containing stuffs like item name, quantity and prices. The first step is to simply read the file and output its containt on a windows form. The second step will be to compute the total cost of each item and post it the results on the form. I guess I have figured out how to do this second part ( well, i guess). But I am stuck on the first step.
This is what I have:
I have the class, reading the txt file, called PartFile. This class contains this function that is supposed to read the file (maybe typecast everything to string) and sent it to the Form.
public void ReadFile()
{
string line;
StreamReader file = new StreamReader("MyFile.txt");
while((line = file.ReadLine()) !=null)
//Console.WriteLine(line); ///commented out because I want to write the file to a Form, not Console
file.Close();
}
While reading my C# book I read about a ToString function, how can I implemente it here to read the file as strings?
Is that how I should code this function, is there anything I should do? how should I do it? Please, help me think through this.I got a brain storm now....can't find a way to get to the next level that I feel i can pretty much do. I just need to be able to read the file and post it to a form. I kind feel like i can move forward on my own (maybe) right after.
Thank, and i hope someone will help... Thank you Alvaro
A Newbie In Tha Block
|
|
|
|
|
Do this instead:
StreamReader file = new StreamReader("MyFile.txt");<br />
string contents = file.ReadToEnd();<br />
file.Close();
That's it, now you have the whole contents of the file in one string. Add a Label control to your form and do:
label.Text = contents;
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|
|
I have a class Client (client.cs) that is serializable and a class RemoteMethods (MarshalByRefObject) with a method public static Client getClient(int clientID). Ok... now the question... how to add a "remote" reference to Client class. I want to access this class without need to have the Client's dll on my client side I want to access this referencing it on another machine... This is possible?
Regards....
Wender Oliveira
.NET Programmer
|
|
|
|
|
Please clearify...
Wender Oliveira wrote: without need to have the Client's dll on my client side.
And another thing
Wender Oliveira wrote: how to add a "remote" reference to Client class
If you are trying to reference something in the client assembly from the server assembly your design is not right. That class must be in the shared assembly.
|
|
|
|
|
Sorry... lol
I want to make a new instance of a class that exists only on my remote server... I don't want to copy the dll that has this class inside to my client server...
Wender Oliveira
.NET Programmer
|
|
|
|