|
Hello
Handle the KeyUp event in all possible control that would receive this combination. you can point them all to one event handler BTW.
Then in that event handler check for the combination. If true call MyToolStripButton.PerformClick() method, or use a common method to do the job.
Regards
|
|
|
|
|
I have multiple separate XSD files and I need to create classes from them using the xsd.exe tool.
Problem is that the class files created by the tool all use the same nomenclature, and so they all conflict with each other with "Already Defined" errors.
How can I create classes for all of my XSD schemas so that they all coexist in the same project?
Thanks,
Rich
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I apologize for posting this questions in two forums, but I feel it pertains to both the .net framework and c#
Hello everybody, I am writing a program in c# for logging/analyzing purposes and am trying to access the information located in another applications datagrid. I figured out how to use the winapi and sendmessage to get text from textboxes, comboboxes, listboxes, etc... but cannot seem to find anything about getting text/info from a datagrid. Is it even possible? I searched msdn for datagrid SendMessage information and nothing of significance was available.
Thanks
|
|
|
|
|
I have a radiobutton(RB1) and a FileUpload server control(FU1) on my page.
if(RB1.Checked == true && (!FU1.HasFile))
{
MessageBox.Show("You must select a file to upload");
FU1.Focus;
}
If the user has checked the radiobutton but not selected any file to upload then I would like to display an error message using MessageBox and bring the focus to FU1 and let the user select the file to upload. I donot want to execute the rest of the code until the user selects the file to uplaod.
Is there a way to do this?
Thanks in Advance,
vct
|
|
|
|
|
Use "else".
---
b { font-weight: normal; }
|
|
|
|
|
Can't a return statement be also used in that circumstance?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Yes, it can.
The reason one might not want to use a return statement, is to keep the single exit point of the method.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I think u can use while loop instead of if statement. thats what i understood from ur code.
POOJA
|
|
|
|
|
No, that will not return control to the user. You have to exit from the event so that the user can change the input.
---
b { font-weight: normal; }
|
|
|
|
|
oh ya...... application.doevents can be used i think bt leave it.
do u have some button click event...... i mean when do u check for file present. If u have such event then in that event u can simply use if and else statement.
POOJA
|
|
|
|
|
Hello,
In your case the ShowDialog Method would be better.
You should create a YourMessageBox class, which inherits from windows.forms.
There you can implement a fileselection, okbutton and exitbutton.
If there is no file selected the okbutton is not enabled.
YourMessageBox class can then implement a Filename property (public), which is set if a File was selected.
At the Button Click Events:
private void okbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Exit();
}
private void exitbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Exit();
}
Code for the class who calls the messagebox:
YourMessageBox mb = new YourMessageBox();
if(mb.ShowDialog() == DialogResult.OK)
{
//mb.Filename
//Do the rest of the code
}
Hope that helps.
All the best,
Martin
|
|
|
|
|
Hello,
I have just found the custom-written event in C# needs to have at least one client registered to consume the event or else the application will crash. Why this is so? This means that if I unregister all the client methods from the event during the time the application is running and then the event occurs, it will crash. Or am I missing something?
Evidence that this is so - test bench program:
using System;
namespace EventsTest
{
public delegate void FirstEventHandler();
public delegate void SecondEventHandler();
public class EventsClass
{
public event FirstEventHandler FirstEvent;
public event SecondEventHandler SecondEvent;
private void FireOffFirstEvent()
{
FirstEvent();
}
private void FireOffSecondEvent()
{
SecondEvent();
}
public void FireOffAllEvents()
{
FireOffFirstEvent();
FireOffSecondEvent();
}
}
public class EntryClass
{
static void Main()
{
EventsClass MyEvents = new EventsClass();
string MyChoice;
do
{
Console.Write("Do you wish to register the event clients to the events? (y/n): ");
MyChoice = Console.ReadLine();
} while (MyChoice != "y" && MyChoice != "n");
switch (MyChoice)
{
case "y":
MyEvents.FirstEvent += new FirstEventHandler(FirstEventClient);
Console.WriteLine("First event registered.");
MyEvents.SecondEvent += new SecondEventHandler(SecondEventClient);
Console.WriteLine("Second event registered.");
break;
case "n":
Console.WriteLine("No events registered.");
break;
}
Console.WriteLine("Firing off all events..");
MyEvents.FireOffAllEvents();
Console.WriteLine("Press enter to continue..");
Console.ReadLine();
}
static void FirstEventClient()
{
Console.WriteLine("First event processed successfully.");
}
static void SecondEventClient()
{
Console.WriteLine("Second event processed successfully.");
}
}
}
C# source and compiled exe attached below.
Any comments on this weird behavior?
Michal
Seems like it's not possible to attach a file here, so you can download the .cs file here: http://kreslik.com/forums/viewtopic.php?t=231[^]
|
|
|
|
|
From the code, it looks like you should be getting an unhandled null reference exception in FireOffFirstEvent() when you do not register the events. This is correct.
When you create the instance of EventsClass, FirstEvent is null. If you do not register the events it is never set.
You call FireOffAllEvents()
which calls FireOffFirstEvent()
which calls FirstEvent() - which is null
One way to solve this is place a check around the delegate invocation, e.g.
private void FireOffFirstEvent() {
if (null != FirstEvent) {
FirstEvent();
}
}
Q.
|
|
|
|
|
OK. But then why there's not the same problem with not registering all the built-in events that come with, say, a windows form?
Does that mean that VisualStudio doesn't even declare these events until I use them and register them?
Michal
|
|
|
|
|
It's exactly the same with the "built-in" events.
Every example for events I know and every place in the BCL where events are invoked first checks if there's an event handler attached.
It has something to do with how the list of event listeners is managed.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
how can we create them in c# they were avilable in foxpro and ms access
┌──────────────────────────────┬─┐
│ text1 │v│
├───────┬──────────────────────┴─┴──────────┐
│ 1 │ text1 │
│ 2 │ text2 │
│ 3 │ text3 │
│ 4 │ text4 │
│ 5 │ text5 │
│ 6 │ text6 │
│ 7 │ text7 │
│ 8 │ text8 │
│ 9 │ text9 │
└───────┴───────────────────────────────────┘
thanks
|
|
|
|
|
Hello
In the search box above this forum page, search for "multicolumn combobox". You'll find some good VB articles, yet you can use them in your C# code by referencing to them.
Regards
|
|
|
|
|
thanks Nader
|
|
|
|
|
I have a DataSet and a Bound DataGrid that displays the data form my database the way I want and expect it to. All works well there. I want to be able to then use the same DataGrid to allow my users to just click on the different cells almost as if they were TextBoxes.
If that isn't possible then I am open to suggestions on how to do this. I am doing this on the web in C# using ASP.NET.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
|
I m working in image processing in C#,actually i have done all work in matlab but now now i have convert it in to C#, Can someone help me,major problem that i m facing is woking with 2d arrays
|
|
|
|
|
Well, this site has plenty of people who will help you. A general idea when posting on this site, or any site is to ASK A QUESTION. The question you should ask shouldn't be along the lines of will someone help me? Just ask the quesiton you want to know the asnwer to that is programming related and, if someone knows how to help, some will help you.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
i want to make report that will open DataBase and read two colum
as (select tblUsrs.grad from tblUsrs)
i want to display label with (exlent, very good,good) by use the tblUsrs.grad from tblUsrs
plz how can make this ........
Palestine
|
|
|
|
|
Tareq, you'll need to be more specific with the problem you're running into. Do you need help reading from the database? Do you need help with displaying the label read from the database? If you're more specific, we can better answer your question.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Dumbest. Movie. Title. Evaaar.
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
i want to send parameter from my form to crestal report file ...
Palestine
|
|
|
|