-
Double-precision math-thematics
Date: 03/29/06
Keywords: no keywords
Is it fairly safe to assume that 3.555 - 3.555 == 0? How about 2.571-2.571? Someone tried to explain the imprecision of double --and other floating point-- types to me once, but I didn't entirely understand it. I assume a number is always represented the same way on a given system, in a given language (or whatever.) Right?
Source: http://community.livejournal.com/csharp/55073.html
-
help with a C# program
Date: 03/26/06
Keywords: programming
Hey everyone...I'm new to programming - taking a beginners C# class. I'm having problems with my latest project...been trying to figure it out all night. Can anyone help? I'm sure it's really simple.
The project is simple - (we're learning about classes): create a form that allows a user to enter information about their pet into text boxes. Create a pet class. Output the summary of the information they entered onto a new form onto labels, not a messagebox.
I believe I did it all correctly....but when I begin coding the Summary button code I get this error:
'P6CM.SummaryForm.petNamelbl' is inaccessible due to its protection level
This is the full code for that button.
private void summaryBtn_Click(object sender, System.EventArgs e)
{
//displays the summary on a different form
SummaryForm summaryFormObject = new SummaryForm();
summaryFormObject.petNamelbl.Text = Pet.Name.ToString();
summaryFormObject.Show();
}
I've tried so many things...has anyone experienced this error?
Source: http://community.livejournal.com/csharp/54361.html
-
DataGrid Madness
Date: 03/23/06
Keywords: programming, database
Hello everyone:
I'm curious if anyone has had in experiance with programming datagrids.
I'm using "C#" and what I want to do is build a report writer.
I populated a Datagrid from an Access database Table, now I want
build controls that let user select what columns to put into their report
and how to filter the rows based on the columns they've chosen.
Ie.
From a listbox you select Account# and ContactName.
The Datagrid shows the full range of Account#'s and ContactName's.
I want to give them a chance to filter the above datagrid by the rows they chose, in this case
Account# and ContactName.
I've devised that I want to try and build a 'Select' and refill and bind the dataset.
I'm just unsure about how to set up the sorting/filtering part. *head scratch*
Any help would be greatly appreciated!
Source: http://community.livejournal.com/csharp/53765.html
-
JOIN vs. DataView[Manager]... or is it?
Date: 03/22/06
Keywords: no keywords
Hey everyone, I'm trying to learn how to use actual ADO.NET stuff (as in, using DataAdapter's, etc. instead of just use a Command object and a DataReader) and I find myself confused by the book I got (O'Reilly's ADO.NET in a Nutshell, which otherwise has been really awesome.) To the question:
Say I have two tables, one table, current_inventory, contains inventory items, and another, locations, contains possible locations, as well some extra information about a given location. current_inventory has a foreign key to the primary key in locations. Now, say I want to populate a DataGrid with the item descriptions and their locations. That's a pretty basic query:
SELECT current_inventory.description
FROM current_inventory
INNER JOIN locations
ON current_inventory.loc_id = locations.loc_id;
The problem is now that if I populate the datagrid and want to change the location, it gets somewhat more complicated (or so I'm told.)
According to this book, it is easier to select the two tables seperately into the dataset, and then somehow use the DataViewManager class to display them. I can't figure out a way to match these up and display each item with its corresponding location, except to do a master-detail type thing, but that isn't what I want to do, because it doesn't seem like a logical way to layout the program.
So, what am I supposed to do, basically, do I just use the join, or is there something I'm missing? Thanks guys (and gals, obviously!)
Source: http://community.livejournal.com/csharp/53647.html
-
Multiselect on bound Datagridview's
Date: 03/17/06
Keywords: no keywords
Ok, I have 3 datagrids, and I have datasources bound to them.
When you click an item on the master grid, the two grids under it filter using The row selected as the criteria of what to display.
if you pick grid #2 grid #3 follows this behavior.
The problem is the app isn't aware of selecting more than 1 row. I have multi-select turned on, so how would I make it use both rows selected?
Source: http://community.livejournal.com/csharp/53006.html
-
Hourly work
Date: 03/16/06
Keywords: no keywords
When you're doing per-hour work, how do you usually bill your clients?
I've found some invoice forms, but they're usually for a specific list
of products or services. Do you just use that as a drill-down for what
you've done or what? Thanks, I'm new at this.
(x-posted)
Source: http://community.livejournal.com/csharp/52818.html
-
Filling three datagridviews from the same bindingsource.
Date: 03/14/06
Keywords: no keywords
Now that those last problems are gone, onto the interesting stuff. And yes, I do know there's a much easier way to do this; my problem, anal chap that I am, is that the bottom of the screen is already way, way too cluttered with bindingsources and tableadapters, and I'd prefer to keep this all in one big shot.
I have a form containing, among other things, three tabs. On each tab is a datagridview. All three datagridfiews are databound to the tongue-twistingly-named fkHospitalsRateDataBindingSource, whence stems the rateDataTableAdapter.
Background, if necessary: there's an FK relationship between Hospitals (the parent) and RateData (the child). What I want to occur: when the hospital is changed on the top half of the form, the rate data updates in the bottom half. THAT part of it is working.
You may be asking why I have three datagridviews. And there is the heart of my conundrum.
The RateData table contains three types of data, specified by the RateTypeIDs of 1, 2, and 3 (RateTypeID is a column in the RateData table). My goal is, both on form load and SelectedPositionChanged for the combobox with the hospital names, to update all three of these datagridviews with, basically, the same query:
SELECT ID, ProvID, Category, DRGs, RevCode, TypeID, Rate, Comment, LineEffective, LineExpiration, RateTypeID FROM dbo.RateData WHERE RateTypeID =
...and it's finished with a number from 1 to 3, depending on the datagridview.
The easiest way I can see to do this is to change the query in the bindingsource to which the datagridview binds. But I cannot for the life of me figure out how to do that. Is it possible to specify a query other than the default in the datagridview's datasource? Thanks.
Source: http://community.livejournal.com/csharp/52430.html
-
Type-matching columns and security issues.
Date: 03/13/06
Keywords: programming, sql, web
Setup: Visual C# 2005 Standard Edition, SQL Server 2000 Enterprise Edition (SP, erm, I think we're up to 6?)
* * *
1. As usual everything I'm rading on the internet seems to have something to do with web programming, and I'm not programming for the web.
I'm trying to set a relation in a dataset, and I'm getting the following error: "Parent Columns and Child Columns don't have type-matching columns." Now, putting aside the embarrassingly painful grammar of that statement, it's quite simply not true; the two columns I'm trying to relate are both int. One was originally no-NULLs-allowed and the other nullable, but changing them to be the same in that cases didn't fix the problem. Anyone know of any other reasons why this error might crop up that actually have nothing to do with te column types involved?
* * *
2. This is an incredibly noobish question, sorry; I'm not used to writing stuff that other people will actually use.
My boss is after a progress report on my current project, so I built a copy of it and put the copy out on one of our network drives to which he also has access. The computer on which he's attempting to run the program has .NET 2.0, so no problem there. When he attempts to run the program, he gets an odd error that I don't remember off the top of my head, but it translates to "SQL Server is not letting you in." Our server is set to require Windows authentication, and he is logged in.
Any ideas? Thanks.
Source: http://community.livejournal.com/csharp/52128.html
-
UserControl with ComboBox
Date: 03/09/06
Keywords: security
(This is my first post here, so don't yell at me)
I have to write a UserControl for my current project in .net 1.1. On this control, there's a ComboBox. I want the ComboBox.Items to be edited in design time, so I created a property:
public ComboBox.ObjectCollection Items
{
get { return securityCombo.Items; }
}
The property is there, but the usual editor for ComboBox.Items is missing. Is there any Attribute I have to assign to the property? I seem to be blind on this.
TIA
Source: http://community.livejournal.com/csharp/51841.html
-
marshalling abstract pointers
Date: 03/09/06
Keywords: no keywords
In C++, you can return pointers to base types to be casted into derived types safely, even if said base type is abstract.
However, there is a slight problem when you need to convert that abstract pointer into something usable in C#. Here's the rundown of what I think is happening.
Firstly, we have an unmanaged function returning a pointer to an abstract base class. That pointer, and its contents, exist on the unmanaged heap. Next, I use Marshal::PtrToStructure, attempting to cast the pointer into the base type of the corresponding managed hierarchy. The PtrToStructure method tries to create a new object on the managed stack, and throws an exception indicating that instantiating an abstract class is right out.
How can I get this pointer converted to a reference that I can use?
DC
Source: http://community.livejournal.com/csharp/51501.html
-
datagridviewcomboboxcolumn woes.
Date: 03/07/06
Keywords: no keywords
Using C# 2005 standard edition.
(Side note: how do I change the default directory to which projects save for one specific project? I'd like this one to go to a flash drive instead of My Documents\Visual Studio Projects.)
I have a datagridview pointing to the Categories table. The categories table contains two ID columns relating to other tables, Indices and Parents. What I'm trying to do is tie the descriptions in those two lookup tables to this datagridview. I'll use Indices as an example, since it comes first. Here's the properties for the IndicesID column:
Appearance:
DefaultCellStyle: DataGridViewCellStyle{}
DisplayStyle: DropDownButton
DisplayStyleForCurrentCellOnly: False
FlatStyle: Standard
Header Text: Index
ToolTipText:
Visible: True
Behavior:
AutoComplete: True
ContextenuStrip: {none}
DropDownWidth: 1
MaxDropDownItems: 8
ReadOnly: False
Resizable: True
Sorted: False
SortMode: Automatic
Data:
DataPropertyName: IndicesID
DataSource: indicesBindingSource1
DisplayMember: Description
Items: (Collection) collection is empty, of course.
ValueMember: ID
Design:
Name: clmIndex
ColumnType: DataGridViewComboBoxColumn
Layout:
AutoSizeMode: AllCellsExceptHeader
DividerWidth: 0
FillWeight: 100
Frozen: False
MinimumWidth: 5
Width: 39
I'm not sure if I'm getting the error from this, parents, or both, but the two are identically laid out, with only Header Text and the Data stuff different. I have checked, and the DataPropertyName combo box still pulls from the original binding source, not indicesBindingSource1 (or parentsBindingSource1), so that's working properly.
When I run the application and open the form, then immediately hit the close button-- without actually changing anything on the form (or if I do, it doesn't matter), I get the following error:
The following exception occurred in the DataGridView:
System.ArgumentException: DataGridViewComboBoxCell value is not valid.
To replace this default dialog, please handle the DataError event.
I'd rather fix the problem than handle the event.
After discovering this page, I checked the tables to make sure foreign keys were there (they weren't, I added them, ran it again, same error) and did visual confirmation that there were no values in the IndicesID and ParentID columns that didn't exist in the lookup tables (there weren't). I also checked to make sure all the ID columns referred to are of the same type (they are, all are int).
I'm out of 'net resources, at least using the search terms I'm using. Anyone have any ideas what else it could be? Any chance it's a slight difference in syntax between Express (where it was originally written) and Standard editions? Because that's about the only option I have left...
Thanks.
EDIT: The foreign key constraints are now also set within the dataset that's driving all the tableadapters. No change.
Source: http://community.livejournal.com/csharp/51302.html
-
One moer stupid question
Date: 03/02/06
Keywords: no keywords
Just one more stupid question and I'll try to leave you guys alone.
I have the first screen that is loaded when the exe is run. It's the log in screen. Now I understand that if I close this form it'll unload the application, no matter what else is going on. So I've decided that after all of the user's information is verified, it'll hide the login screen and bring up the main window. Here's where the problem is. After the user is done with what he/she needs to do, there's a "log out" command. When that is clicked, it closes the main window and then we're stuck with an invisible form that I can't figure out how to bring back using the .Show() method.
I've tried trying to unhide it from the main window (frmLoginForm.Show();) but that always gives me an error (as if it doesn't exist). I've also tried to create a function that would handle all of that for me, and calling it from the main window as it's closing.. again, it says it doesn't exist.
So what am I missing? There must be a way to unhide it after the main window is done..
Thanks, again, for putting up with the stupid questions I have.
Source: http://community.livejournal.com/csharp/50959.html
-
INI file questions
Date: 02/28/06
Keywords: database, java
Hi all!
I've been trying to go from beginner's Java to C#, as I prefer C# much more. I just love the feel of it and the ability to design the forms much like VB.NET is a huge time saver for me. Still, there's some things that I just can't seem to figure out (nor can seem to locate on the internet).
Basically I'm going to be making a text adventure game in C#, but I like to store all of the data in INI files. I'd like to have one .txt file and inside it would store every room with exits and interactive objects. For example:
[0001]
Name=Town Square
Exits=north, south
North=0002
South=0003
[0002]
Name=North of Town Square
Exits=north, south, east, west
North=0004
South=0001
East=0005
West=0006
NPCs=A strange old man
etc etc etc.
And another file for all of the NPCs, what they'd say to the player and so on. But the problem is.. I'm not sure how to actually READ ini files in C# (or Java, or C, or C++, or VB.NET for that matter). I'm not sure if there's a better way of doing this. I don't know any database commands, or if I can even run them (or if any of the player who eventually download this can run them either). I figured with this I could include the rooms.txt as part of the program (as a resource, like images) and that way there'd be no question of players messing with them or peeking at them to see where to go/do/etc.
So my real reason for this post is to ask for help on learning how to read/write INIs (I may want to write a player file in INI format, then encrypt it).
Any help or tips would be most appreciated.
Source: http://community.livejournal.com/csharp/50870.html
-
Clearing entries from the Recent Projects panel?
Date: 02/26/06
Keywords: no keywords
this is atually a Visual Studio IDE question, sorry...
Using Visual C# Express Edition 2005.
Is it possible to clear entries from the Recent Projects panel? I have to instaces of a project I'm working on showing up (I started over from scratch), and I'd like to get rid of the old one, if I could.
Thanks.
Source: http://community.livejournal.com/csharp/50514.html
-
strongly typed resources problem
Date: 02/15/06
Keywords: microsoft
hiya.
I tried to use resgen.exe (/str:cs) to convert my .resx file into a nice class with get properties for all of my resources. I end up getting a MissingManifestResourceException whenever I try to access a resource from this class. It says it can't resolve the .resources file, even though I added it to and embedded it in my build.
Then I went the alternate route and used StronglyTypedResourceBuilder.Create("C:\\Documents and Settings\\bprice\\My Documents\\Visual Studio 2005\\Projects\\str\\str\\Properties\\Resources.resx", "Resources", "str", new Microsoft.CSharp.CSharpCodeProvider(), true, out errors);
to generate the class. Now I don't know where it put the Resources.cs file(and I tried specifiying a path).
Any clues to how I can access my resources from either approach?
//EDIT//
These two tools are absolutely useless. My VP browsed the MSDN magazine and found you can do [proj namespace].Properties.Resources.[resource name], which accesses a get property of the resource.
Source: http://community.livejournal.com/csharp/50334.html
-
Вышел №53 рассылки .Net Собеседник
Date: 02/13/06
Keywords: no keywords
For russian only - <
Выпустил первый в этом году номер рассылки ".Net Собеседник".
Посмотреть его можно здесь - http://subscribe.ru/catalog/comp.soft.prog.dotnetgrains
/>
Source: http://community.livejournal.com/csharp/49962.html
-
CcertRequest secutiry issue
Date: 02/11/06
Keywords: asp, security, web
It's probably not the best group to ask but in case someone has faced this problem, I will :)
I am trying to build a asp.net 2.0 web service that will request and
get certificates from three different MS CA services. The whole thing
is done with CERTCLIENTLib.CCertRequestClass and works fine as long as
the web service is located on the same machine with the CA.
My need is to make it call other CA's when I do my
CCertRequestClass.Submit().
As many of you probably guessed, I am getting this while error:
CCertRequest::Submit Access is denied. 0x80070005 (WIN32: 5)
Oh well, I tried to play with target CA security settings and DCOM
settings and turned audit for anything I could and did read everything
I could find on this error message. Nothing really helped.
It seems like the CA machine is just not letting the call to reach the
machine's DCOM. I could get this message in security event log:
Event Type: Failure Audit
Event Source: Security
Event Category: Logon/Logoff
Event ID: 529
Date: 10.02.2006
Time: 19:38:02
User: NT AUTHORITY\SYSTEM
Computer: **********
Description:
Logon Failure:
Reason: Unknown user name or bad password
User Name: ************
Domain: *********
Logon Type: 3
Logon Process: NtLmSsp
Authentication Package: NTLM
Workstation Name: **************
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: ***.**.***.**
Source Port: 3766
-------------------------------------
The machines are not on the same domain - it's one of the requirements
to the whole thing.
Can someone suggest an approach or something to get it all to work or
shall I just forget about the idea?
Source: http://community.livejournal.com/csharp/49813.html
-
Refresh a dataset?
Date: 02/09/06
Keywords: microsoft
I do hope this is an easier question (and that the answer isn't marred by an obscure Microsoft bug this time) than the last one.
I was going to try and do this generically, but it got too long-winded.
Form A: Categories. One of the columns in the datagridview is Parent (the Parent of the Category, naturally), and that column (a comboboxcolumn) has a datasource that points to the Parent table insteadof the Category table, and a Value Member of Parent. Form A also contains a button to open up form B.
Form B: has a datagridview that allows editing of the Parent table (to add new Parents).
At present, the code for the button on Form A is very simple:
BrowseParent frmParent = new BrowseParent();
frmParent.Show();
What I'd like to be able to do is monitor frmParent from inside this routine, and force the dataset pointing to the Parents table to refresh after frmParent closes (or, better, when btnSave is pressed in frmParent). Which leads me to two questions:
1. Is it possible to check from inside this routine to see if frmParent has closed? Or is it ultimately going to be easier friending the class(es) and doing it that way?
2. Is it, in fact, possible to force a refresh of a dataset without closing and reopening the form? Can't seem to find anything on it in BOL, and the dataset doesn't seem to have a Refresh() command attached to it.
Strike that, I really am as dumb as I look. I just called the tableadapter's fill() routine again.
Thanks.
Source: http://community.livejournal.com/csharp/49637.html
-
Strange Behavior
Date: 02/08/06
Keywords: web
I have a WebPart written in C#. There are buttons on the main screen, which take me to other views. The Buttons on the main View fire off the correct events, however the buttons on other views do not.
public void CreateViewState
{
...
Button addRFI = new Button();
addRFI.Text="Add New RFI";
addRFI.Click += new EventHandler(addRFI_Click);
...
}
public void CreateAddState
{
...
Button submitRFI = new Button();
submitRFI.Text = "Submit";
submitRFI.Click += new EventHandler(submitRFI_Click)
...
}
protected void addRFI_Click(object sender, EventArgs e)
{
this.CurrentState = RFIState.AddSate;
}
protected void submitRFI_Click(object sender, EventArgs e)
{
// Process RFI ADD HERE
}
OK, So I set a break point in each of the Click Routines, Load up My SharepOint with the WebPart. Click on Add RFI, and the program breaks on the BreakPoint in addRFI_Click, loads the Form with the Submit button on it. Press the Submit Button, and the program breaks at the break point in the addRFI_Click event , NOT the event it is tied too.
What in the world is going on here???
Source: http://community.livejournal.com/csharp/49283.html
-
Object behind bindingsource never changing.
Date: 02/07/06
Keywords: database, sql, web
C# 2005 Express Edition.
Okay, quickest way to explain this situation: I have a DataGridView attached to a local Access database. The DGV pulls in three columns. My goal here is to get changes in the columns to update to the table automatically a la an open Access table window (or SQL Server Entierprise Manager or FoxPro or... you know). I started with the code in this CodeProject article.
The first change I've had to make to it is that it seems I have to instantiate the tableadapter before calling its Update() method. All well and good, though I'm not sure I did it correctly. Make the change, run again, and same result: I can change stuff to my heart's content in the DataGridView, but none of the changes are propagated to the database. I added the MessageBox you see in the UpdateRowToDatabase method; it never fires.
My question (again assuming I instantiated the tableadapter correctly): do I also need to instantiate the bindingsource? If so, how, because I can't find anything about it anywhere online or in the help files?
If not, can someone give me some idea of what it is I'm doing wrong? Thanks.
Problem solved, thanks to 109. Except for one oddity I'm going to go squash now...
EDIT2: bloody hell. I THOUGHT I had it...
sequence of events.
1. Fire up proggy.
2. Change a few rows, varying what I change in any given row.
3. With each change, event fires. (This is a major step forward, anyway.)
4. Close form.
5. Open form again (from the main form that calls it).
6. Look for changes. They are still there.
7. Exit program.
8. Start program again.
9. Open form.
10. Check for changes made when program was previously running... and they're not there.
(I've also gone in through Access and looked; the changes are not propagating.)
It looks as if the ThisCategoriesTableAdapter.Update(LastDataRow) command is updating the DataSet rather than the database itself. But everything I've seen on MS' website says specifically that the Update command will, in fact, update the database.
Changes to the program code integrated below.
Thanks!
public partial class BrowseCategories : Form
{
categoriesDataSetTableAdapters.CategoriesTableAdapter ThisCategoriesTableAdapter = new categoriesDataSetTableAdapters.CategoriesTableAdapter();
//tracks PositionChanged event for last row
private DataRow LastDataRow = null;
public BrowseCategories
{
InitializeComponent();
}
private void BrowseCategories_Load (object sender, EventArgs e)
{
this.parentsTableAdapter.Fill(this.parents._Parents);
this.categoriesTableAdapter.Fill(this.categoriesDataSet.Categories);
this.dgCategories.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
//Is there a way to add an event handler from the design screen?
categoriesBindingSource.PositionChanged += new EventHandler(categoriesBindingSource.PositionChanged);
//Set LastDataRow initially, or if you try to change the first row, the event handler won't fire
BindingSource thisBindingSource = (BindingSource)categoriesBindingSource;
LastDataRow = ((DataRowView)thisBindingDource.Current)>Row;
}
private void UpdateRowToDatabase();
{
if (LastDataRow != null)
{
if (LastDataRow.RowState == DataRowState.Modified)
{
ThisCategoriesTableAdapter.Update(LastDataRow);
}
}
}
private void categoriesBindingSource_PositionChanged(object sender, EventArgs e)
{
BindingSource thisBindingSource = (BindingSource)sender;
DataRow thisDataRow = ((DataRowView)thisBindingSource.Current).Row;
if (thisDataRow == LastDataRow)
{
throw new ApplicationException("It seems the PositionChanged event has fired twice for the same row.";
}
UpdateRowToDatabase();
LastDataRow = thisDataRow;
}
private void btnParent_Click(object sender, EventArgs e)
{
BrowseParent frmParent = new BrowseParent();
frmParent.Show();
}
private void BrowseCategories_FormClosed(object sender, EventArgs e)
{
UpdateRowToDatabase();
}
}
}
//I seem to have added an extra bracket... keeping it in case I screwed up the formatting somewhere.
As I retyped it all, assume any typos are unique to this rendition. The code does run (it just doesn't update the database).
EDIT:: as requested by 109 the InitializeComponent() method:
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.dgCategories = new System.Windows.Forms.DataGridView();
this.parentsBindingSource = new system.Windows.Forms.BindingSource(this.components);
this.parents = new HospitalRates.Parents();
this.categoriesBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.categoriesDataSet = new HospitalRates.categoriesDataSet();
this.btnParent = new System.Windows.Forms.Button();
this.btnCorrect = new System.Windows.Forms.Button();
this.btnDone = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.categoriesTableAdapter = new HospitalRates.categoriesDataTableSetAdapters.CategoriesTableAdapter();
this.parentsTableAdapter = new HospitalRates.ParentsTableAdapters.ParentsTableAdapter();
///a word of explanation: the control below started out life as a text box column because
///I'm a forgetful bastard, and name hasn't changed because I'm lazy, as well.
this.ParentsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.CategoryDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dgCategories)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.parentsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.parents)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.categoriesBindingSounrce)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.categoriesDataSet)).BeginInit();
this.SuspendLayout();
//
//dgCategories
//
this.dgCategories.AutoGenerateColumns = false;
this.dgCategories.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
///note: I swear, there's no extra indentation here!
this.dgCategories.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.parentDataGridViewTextBoxColumn,
this.categoryDataGridViewTextBoxColumn,
this.descriptionDataGridViewTextBoxColumn});
this.dgCategories.DataSource = this.categoriesBindingSource;
this.dgCategories.Location = new System.Drawing.Point(14, 14);
this.dgCategories.Name = "dgCategories";
this.dgCategories.Size = new System.Drawing.Size(739, 393);
this.dgCategories.TabIndex = 0;
//
//parents
//
this.parents.DataSetName = "Parents";
this.parents.DataSchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
//categoriesBindingSource
//
this.categoriesBindingSource.DataMember = "categoriesDataSet";
this.categoriesBindingSource.DataSource = this.categoriesDataSet;
//
//categoriesDataSet
//
this.categoriesDataSet.DataSetName = "categoriesDataSet";
this.categoriesDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
//btnParent
//
this.btnParent.Location = new System.Drawing.Point(14, 432);
this.btnParent.Name = "btnParent";
this.btnParent.Size = new System.Drawing.Size(135, 36);
this.btnParent.TabIndex = 1;
this.btnParent.Text = "Add/Edit Parent";
this.btnParent.UseVisualStyleBackColor = true;
this.btnParent.Click += new System.EventHandler(this.btnParent.Click);
//
//btnCorrect
//
this.btnCorrect.Location = new System.Drawing.Point(215, 432);
this.btnCorrect.Name = "btnCorrect";
this.btnCorrect.Size = new System.Drawing.Size(135, 36);
this.benCorrect.TabIndex = 2;
this.btnCorrect.Text = "Correct Existing Data";
this.btnCorrect.UseVisualStyleBackColor = true;
//
//btnDone
//
this.btnDone.Location = new System.Drawing.Point(617, 432);
this.btnDone.Name = "btnDone";
this.btnDone.Size = new System.Drawing.Size(1356, 36);
this.btnDone.TabIndex = 3;
this.btnDone.Text = "Done";
this.btnDone.UseVisualStyleBackColor = true;
//
//categoriesTableAdapter
//
this.categoriesTableAdapter.ClearBeforeFill = true;
//
//parentsTableAdapter
//
this.parentsTableAdapter.ClearBeforeFill = true;
//
//parentsDataGridViewtextBoxColumn
//
this.parentsDataGridViewTextBoxColumn.DataPropertyName = "Parent";
this.parentsDataGridViewTextBoxColumn.DataSource = this.parentsBindingSource'
this.parentsDataGridViewTextBoxColumn.HeaderText = "Parent";
this.parentsDataGridViewTextBoxColumn.Name = "parentDataGridViewTextBoxColumn";
this.parentsDataGridViewTextBoxColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.parentsDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.parentsDataGridViewTextBoxColumn.ValueMember = "Parent";
//
//categoryDataGridViewTextBoxColumn
//
this.categoryDataGridViewTextBoxColumn.DataPropertyName = "Category";
this.categoryDataGridViewTextBoxColumn.HeaderText = "Category";
this.categoryDataGridViewTextBoxColumn.Name = "categoryDataGridViewTextBoxColumn";
//
// descriptionDataGridViewTextBoxColumn
//
this.descriptionDataGridViewTextBoxColumn.DataPropertyName = "Description";
this.descriptionDataGridViewTextBoxColumn.HeaderText = "Description";
this.descriptionDataGridViewTextBoxColumn.Name = "descriptionDataGridViewTextBoxColumn";
//
//BrowseCategories
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Windows.Drawing.Size(772, 515);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.btnDone);
this.Controls.Add(this.btnCorrect);
this.Controls.Add(this.btnParent);
this.Controls.Add(this.dgCategories);
this.Load += new System.EventHandler(this.BrowseCategories_Load);
((System.ComponentModel.ISupportInitialize)(this.dgCategories)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.parentsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.parents)).EndInit();
((System.ComponentModel.ISupportInitalize)(this.categoriesBindingSource)).EndInit();
((System.ComponentModel.ISupportInitalize)(this.categoriesDataSet)).EndInit();
this.ResumeLayout(false);
}
Ah, the problem becomes clear... the event handler never registered...
Source: http://community.livejournal.com/csharp/49005.html