|
You need to override the ProcessDialogKey method of the form. The follow code will allow you to block ALT-F4 from closing your application.
protected override bool ProcessDialogKey(Keys keyData)
{
Keys altf4 = Keys.Alt | Keys.F4;
if (keyData == altf4)
{
return true;
}
return base.ProcessDialogKey(keyData);
}
|
|
|
|
|
It works like a charm! Excellent
Thanks a lot for the help, Nick
|
|
|
|
|
I am trying to implement a structure that starts with a root class which points to many different nodes. Each node then points to two unique classes. I would like to be able to add nodes and hence the two classes associated with each node. Any help on this would be greatly appreciated.
cheers
mike
|
|
|
|
|
So you just want a class represenative of your root that contains an array of each unique class?
|
|
|
|
|
I am knew to this coding thing so could you be a bit more specific?
I basically want to store "player" data in a struct (i guess) or class. I then want to add struct's or classes to the "player" namely "assesment dates". Attached to each date are two struct's or classes that contain various assesment data. Is that what you thought in the first place?
thanks for your response
regards
mike
|
|
|
|
|
Something like this?
class RootNode
{
Node[] nodes;
}
class Node
{
UniqueNode1 node1 = null;
UniqueNode2 node2 = null;
}
Insertion functions, array initialization and all the stuff is left as an exercise :p
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I am knew to this coding thing so could you be a bit more specific?
I basically want to store "player" data in a struct (i guess) or class. I then want to add struct's or classes to the "player" namely "assesment dates". Attached to each date are two struct's or classes that contain various assesment data. Is that what you thought in the first place?
thanks for your response
regards
mike
|
|
|
|
|
mcrooks wrote:
I basically want to store "player" data in a struct (i guess) or class. I then want to add struct's or classes to the "player" namely "assesment dates". Attached to each date are two struct's or classes that contain various assesment data. Is that what you thought in the first place?
Yes, it's almost the same, but a list will be enough for the players and assesment dates. Something like that:
List<Player> players = new List<Player>();
class Player
{
public name = "Some Name";
public List<AssesmentData> data = new List<AssesmentData>();
}
class AssesmentData
{
public object data1 = ...
public object data2 = ...
}
You can modify it like that
Player player1 = new Player();
player1.name = "Peter Someone";
AssesmentData task1 = new AssesmentData();
task1.data1 = "Some string";
task1.data2 = 50;
AssesmentData task2 = new AssesmentData();
task2.data1 = 3.3f
task2.data2 = @"C:\Some\Path";
player1.data.Add(task1;
player1.data.Add(task2);
players.Add(player1);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
I have a windows form with the following controls on it.
A datagridview and a couple of text boxes.
The text boxes are bound to the same data source as the datagridview so that when I click on a row, the listboxes are populated with the same record shown in the datagridview control. (Note : all the binding is done in code and crated at runtime). This works well until I try to add a record to this datagrid. Being a bound control it does not let me call control.rows.add(etc).
If I click on the "add row" row, I get the correct events and the text fields get cleared. When I click on the text field to add the new data, ALL the text fields are populated with the last record in the datagridview even though the selected record ov the datagridview stays on the Add Record (*) row.
1) How do I get to add a new row to this dataset without going to the extreme of bringing up a new form, populateing the database through 'Good old SQL' and refreshing the database of the grid when I close the form.
2) Can I add a record to this recordset without using the "new row"?
|
|
|
|
|
I think following steps will solve your problem
• Fill text boxes on the click event of data grid
• Clear text boxes on click of button (add new row button)
• Now on save button add new row in table(data source) by any method and refresh the data source .(DataGrid.DataSource = DataTable/DataView/)
sameer
|
|
|
|
|
Thanks for the response. I think you may have misunderstood my question or I did not word it properly. If there is data in the underlying table I am able to edit it without any trouble. It is adding new data that is causing the problem. When I click the on the new record row, the text boxes are automatically cleared. when I click off off the row, the datadapter update statment is not inserting the new data. I am using OleDbCommandBuilder so the update is handled automatically. I assumed the same woulde be for an insert. Is this the case. If not so, it may be where my problem is.
|
|
|
|
|
i think problem statement is as Follows
Problem statement: you have have data in datagrid and you are able to update any row but when u want to insert new row then last selected row or last row get updated
Solution: command Builder is well enough to insert new row or to update row.do one thing if there is data present in data table the ad new row and data table by DataTable.row.add(new object[]{value1,value2..}), and now refresh the dataSource
sameer
|
|
|
|
|
Hi All,
While am working for more that 5min.am getting aproblem as below...
The CLR has been unable to transition from COM context 0x192008 to COM context 0x192158 for 60seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment
(STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
so plz help me how to solve the problem to run the application for more than 20min.
Thanks in advance,
Rgds,
cnr369.
|
|
|
|
|
The error message means that one of your STA apartments is not pumping i.e it has blocked without processing incoming messages. Look for methods with the [STAThread] attribute and check if they are pumping.
|
|
|
|
|
hi
i want to Convert My DataTable to excel Project correctly . How to do ??
(i found an article [ Converting Database records to Excel file(Very simple code) ] that convert datatable to excel but it was not worked correctly (my records was collapsed and corrupted).
please give me an example that convert Northwind.Orders Table to Excel correctly .
thanks ..
|
|
|
|
|
Hello
You can export any DataTable to any Database provider -including excel-, by writing it to an Xml file. So for a table you'd use DataTable.WriteXml() , or for multiple tables use DataSet.WriteXml() . Then use an XmlWriter to write it to a file. There isn't much of a code in it actually.
Regards
|
|
|
|
|
how can we bind DataReader() results to a table in asp.net WebForm (in dynamic format)(without using DataAdapter())??Please help me.... its urgent.... ![Confused | :confused:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
the thing is i have a really large picture (1600 X 1200) and i have to put it in a picture box on a form. The form is at maximum size (1200 X 1000) so only a part of the picture is dyplayed becouse the picture box is larger than the form. The question is can implement some kind of scrollin on the picture and how do i do that?
rzvme
|
|
|
|
|
This should be possible by putting the PictureBox (full size of picture) into a Panel (wanted size) which is a scrollable control.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
my project does not depend on virsual connection and virsual dataset
and when i design the report i design it on virsual dataset after i finsh the design i remove the dataset and i asign for the report datasourse {My dataset} but when i run the report does not have the data in my dataset
how can i solve it
thanks for help
fatma
|
|
|
|
|
You might find this[^] documentation on MSDN helpful.
|
|
|
|
|
Hi Friends,
I developed a desktop applcation in .NET 1.1 frameework using C#.
The application works perfect in Windows XP or Windows 2000 Server environment, but in Windows 2003 server the application is really slow. The performance is degraded upto 200%. i.e. it takes 4 times more time in Windows 2003 server than under Windows XP or Windows 2000 server.
Can anyone tell me what is the problem and can it be rectified.
Thanks,
Sushant Duggal.
|
|
|
|
|
That's a fairly broad question, have you tried profiling the application? If you don't have a commerical profiler, try the CLR Profiler[^] from Microsoft.
|
|
|
|
|
I was doing some final testing on a program that I build last week, when I encountered the following error in a databound datagridview
DataGridViewComboBoxCell value is invalid
It happend without a real reason, because nothing has changed since the last test and that last test succeeded without error.
Anybody have a clue as what might be going on here? I checked the databinding, but that seems correct to me. So it must be something else.
WM.
What about weapons of mass-construction?
|
|
|
|