
csharpener
Members-
Posts
15 -
Joined
-
Last visited
csharpener's Achievements
Newbie (1/14)
0
Reputation
-
Hi all, Can anyone help with this? I have a WINDOWS form that contains a DataGrid and 20 odd TextBoxes on it. Both the grid and textboxes are databound to a dataset created at runtime to join 6 SQL Database tables. A field held in the single DataSet holds a string value relating to the context of that particular row. The user wants to view any row with a particular context in RED wherever it appears on the form... so if there are twenty "F" contexts in the grid, these rows will be colored red and the others will be black. If the user selects a red row in the grid, the data displayed in the textboxes will be red too. I have tried creating an extra column in the dataset to hold a System.Drawing.Color.Value and binding each controls' ForeColor property to that, but cant seem to store an object like that in the dataset. Storing the color as a string throws a "cannot convert __blah_blah" error. Does anyone understand what I'm trying to do and have some way of making it happen ? :) Cheers if u can help CS
-
thanks donnacha :) I was beginning to think I was the only one suffering from this problem... At least I now know I'm not alone L8R CS
-
Isn't it hard enuff cleaning a porcelyn one? imagine the drama involved with a gold crapper? "hey buddy... just gonna take a dump"... "OK PaL... watch out for the armed guards and swat team on duty..."
-
Which O/R mapping tool are you using with .NET
csharpener replied to Bobh's topic in Database / XML / Reporting
(IMHO) Orm.Net is pretty kewl but would be better if it could create objects based on views as well as tables.... (or does it?) still requires complex joins in code (using JoinPath or FetchPath) even though they are known at the time of layer generation... If I ever get time off work I'd like to extend the OrmLib in this direction... -
hierarchical grids (datarelation)
csharpener replied to bernhard7gruber's topic in Database / XML / Reporting
ok... i think I understand what you mean now... Once you have selected a record in the master (grid) you want to show the slave grid with only the records that are related to the selected row in the master (grid)... ? one way to do this might be to find the relation field in the master DataSet and filter the slave DataSet based on this value. IE (sorry.. this is C# syntax) private void MyGrid1.CurrentRowChanged(object sender, System.EventArgs e) { DataRowView DV = (DataRowView)MyGrid1.BindingContext[DataSet11, "master"].Current; FilterDataSet2(DV["Row_ID"]); } private void FilterDataSet2(int row_id) { this.DataSet11.Tables["Slave"].DefaultView.RowFilter = "ForeignKeyField = '" + ROW_ID " "'"; } maybe someone will translate this to VB? (or have a better suggestion :)) CS -
Efficient Iteration of a Dataset
csharpener replied to Enigma151's topic in Database / XML / Reporting
Hi dsgreen57... Do you have any simple examples of how this is done or links to a basic example for the XSLT transformation services? Thanks CS -
Hi, so it appears you have a table(s) reflected by a dataset (database view) which is displayed in a datagrid... you select a record in the datagrid and want to be able to edit that row in the textboxes (database table) on the same form... that is a good question :) but I wonder why you are using the view... you could bind the grid to the (table) dataset and make the grid readonly and bind the textboxes to the same dataset and as you click through the grid records, the same (editable) info is displayed in the textboxes... If my understanding of the problem is incorrect you could also query the currencymanager of DataSet1 and filter or select DataSet2 based on that query.... eg [C#] DataRowView DV1 = (DataRowView)this.DataGridName.BindingContext[DataGridName.DataSource, "TableName"].Current; DataRowView DV2 = DataSet2.Tables["TableName"].DefaultView.Select("ID_Column = '" + DV1["ID_Column"] + '")"; DV2 now holds a DataRowView (direct editable pointers) to the records for the selected row in your table... does this help? CS
-
hierarchical grids (datarelation)
csharpener replied to bernhard7gruber's topic in Database / XML / Reporting
what is displayed in a datagrid is (usually) defined by the TableStyle property of the grid. You need to define the TableStyle for the Master/Slave_1/Slave_2/etc/etc view you want to show in your grid and assign the MappingName property of each TableStyle to each view. Although when you first start doing this it seems complex and too much hassle, it quickly becomes easy and KewL... check out the DataGrid section here... Windows Forms FAQ for lots of really useful info on getting to grips with the DataGrid control -
the error is a bit vague but it appears to me that the record you are trying to insert has an int identity or autonumber and the code you are using is trying to assert a primary key value. check the INSERT statement to see if your dataset or code is trying to specify what the primary key value will be - SQL server is probably handling this management itself and saying to your vb.net code "Bugger Off thats my job PaL"...
-
dunno if this helps... here is what I have used ...first create a delegate... public class ClassName public ClassName() { public delegate void PlusButtonClickEventHandler(object sender, System.EventArgs e); //define the event... public event PlusButtonClickEventHandler PlusButtonClick; } // within the class you are referencing the control/class add // an event constructor... ... public class SomeOtherClass : System.Windows.Forms.Form public SomeOtherClass() { this.form.PlusButtonClick += new ClassName.PlusButtonClickEventHandler(Function_Name); // then add the function private void Function_Name(object sender, System.EventArgs e) { //do stuff; } } CS
-
Thanks Mutant but that makes no visible difference. It was my understanding that the form.Close routine just invokes the form.closing event which in turn calls Dispose anyway. I think it may have something to do with the Validate routine (base) - investigating this but if anyone else has another idea please let me know... Cheers CS
-
Hi all, Does anyone here know how or why a form will erratically disappear when disposing? I am developing a large app with various forms being accessed via calls like the one below: public static DialogResult getResult(ref int id) { MyForm form = new MyForm(); DialogResult dg = form.ShowDialog(); try { id = form.txtID.text; } catch(System.Exception ex) { Console.WriteLine(ex.Message); dg = DialogResult.Cancel; } form.Dispose(); return dg; } All the forms involved in the app have large numbers of textboxes, datagrids, datasets etc and all the update routines involved with a normal db app. The problem is when disposing any of these forms (for example after a user clicks an exit button) the form remains on screen for a second or two with a kind of washed-out look. When there is another form under the disposing one or a new form opening, the closing one makes the app look really slow and ugly... Is there some way to get rid of this behaviour? Thanks if you can help ...CS