|
What you want is the tables schema rowset...
<br />
OleDbConnection conn = new OleDbConnection();<br />
<br />
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; ...etc. ";<br />
conn.Open();<br />
<br />
DataTable schemaTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,<br />
new object[] {null, null, null, "TABLE"});<br />
<br />
foreach (DataRow table in schemaTable.Rows)<br />
{<br />
}<br />
conn.Close();<br />
|
|
|
|
|
Thank you very much for your help.
'OleDbSchemaGuid.Tables' contains both tables as well as views of the database, but with the way suggested by you we can get only tables.
I've tried for getting View, with the second argument of GetOleDbSchemaTable like this...new object[] {null, null, null, "VIEW"}. It is working perfectly.
But for that I'll have to repeat the call twice, onc for table and another one for view. Is there any way to get both tables as well views in one call.
Thanks.
Pranoti
|
|
|
|
|
Hi, I've got a bit of a problem with using a data grid in a window application. The application crash if I try to double click on the resize row height cursor. ie. When my cursor is in between two row headers and the cursor becomes the resize cursor. Usually, when you double click in between columns, it automatically resize the columns. However, when I try to do the same with the rows, it crashes with this error message: "Fatal system error has occured. Index was out of range. Must be non-negitive and less than the size of the collection. Parameter name: startIndex, mscorlib"
Is there anyway I can disable the feature of allowing the user to resize the rows??
Thanks in advance.
|
|
|
|
|
Have you tried overriding the OnResize?
Rocky Moore
|
|
|
|
|
Hi
OnResize would be related to the Datagrid control itself.
Rather try overriding OnPreferredRowHeightChanged in the DataGridTableStyle class. Like:
<br />
myGrid.Font = new System.Drawing.Font<br />
("Microsoft Sans Serif",<br />
15, System.Drawing.FontStyle.Regular);<br />
myGrid.PreferredRowHeight = myGrid.Font.Height;<br />
|
|
|
|
|
Wow, happens on my DataGrids too! Must be a bug in the MS code... no? In any case, exceptions should not reach the user like that!
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I have a problem getting my column headers correctly aligned in my datagrid. I've got a total of six columns and in most of them the column header text is right next to the column border with no margin/padding at all. In a couple of the columns the alignment seems to work though, but I haven't been able to any difference that should matter.
Here's a small portion of the code, taken from the InitializeComponent method:
this.dataGridTextBoxColumn5.Alignment = System.Windows.Forms.HorizontalAlignment.Right;
this.dataGridWaterColumn.Format = "p1";
this.dataGridWaterColumn.FormatInfo = null;
this.dataGridWaterColumn.HeaderText = "Percent";
this.dataGridWaterColumn.MappingName = "Percent";
this.dataGridWaterColumn.Width = 80;
The data is correctly aligned, it's just the header text that is misaligned. How come? The problem is the same whether I choose left, right or center alignment.
|
|
|
|
|
Can someone help me with a flicker free listview. I have tried setting the control styles but that doesnt seem to work. And when i set the control style UserPaint to true only the columns of the listview are painted. I guess this is because we are then responsible for all the painting. However, I dont want to go through all of that. Does someone know of another way to do this.
|
|
|
|
|
I had a similar problem a while back. Make sure that:
1. the control dont get invalidated after adding each item
2. you are not adding new items using AddRange()
within a loop.
Hope this helps
|
|
|
|
|
So should i be using the style controls?
|
|
|
|
|
I can't afford a copy of Visual Studio .NET for home use, so I'm trying to learn C# and .NET the cheap (hard) way i.e. the .NET SDK, a text editor and the command prompt. What I'd like to write are some Windows Forms applications, but I can't stand the thought of having to write the form layout by hand. Does anyone know of a free form designer that I can download and use with C#?
Gavin
|
|
|
|
|
Now if someone would just write a flash to usercontrol converter that would be nice or even better, the other way around, so we can get rid of those lame default web controls
|
|
|
|
|
The Visual Studio .NET Academic version is not so much expensive (did I spell it right?).
About $120.
I've bought that!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Hello!
Is it possible to reuse context menu items in the main menu(maybe from the designer,too) ? Or do I have to declare two menu items for duplicate commands and enable/disable them seperately for the same reasons (because something like CloneMenu would only clone the current property values me thinks)?
Cheers
and TIA
Martin
"Situation normal - all fu***d up"
Illuminatus!
|
|
|
|
|
Hi there! I've got 3 questions about programming C# controls:
1. How can I bind my own property to one of the categories that are displayed in the Properties window (like 'Behaviour' ora 'Apperance')? Can I make my own cathegory?
2. I would like the control to know, if it's in a Design mode or in a running app. User has to add all data to my control dynamicly and I want control to display some example while being in Design mode (sth. like TreeView in Win32 API in Resource Editor). How can I implement thing like that?
3. How can I change the control's icon that is displayed in the Toolbox?
Please! Help me!
MP
Maciej Pirog
|
|
|
|
|
Maciej Pirog wrote:
1. How can I bind my own property to one of the categories that are displayed in the Properties window (like 'Behaviour' ora 'Apperance')? Can I make my own cathegory?
Use the 'CategoryAttribute' on one of your control's properties
Maciej Pirog wrote:
2. I would like the control to know, if it's in a Design mode
Take a look at the Control.DesignMode property
Maciej Pirog wrote:
How can I change the control's icon that is displayed in the Toolbox?
Embed a bitmap in your assembly named the same as your control's fully qualified typename (plus .bmp). So if your control's full name is MyNamespace.MyControl, 'embed as resources' a 16x16 bitmap in your project named 'MyNamespace.MyControl.bmp'. Recompile, and studio should use that bitmap on the toolbox.
Check out the code for PropertyTree for an example of embedding Toolbox bitmaps in a control assembly.
--
Russell Morris
"WOW! Chocolate - half price!" - Homer Simpson, while in the land of chocolate.
|
|
|
|
|
Thanks! Tht's what I needed!
MP
Maciej Pirog
|
|
|
|
|
I have a webForm,Iwant that when the user click a button the page will change and I want to send this new page parameter (int id , string or anything else),
how can I do it? I move to the next page by:
Response.Redirect(...)
thank you very much, sharon
|
|
|
|
|
Look at the following link from MSDN
Clickety
|
|
|
|
|
I have seen the newest .NET show on the web recently and it introduced the ORM (Object Role Modeling). I think that this is a very good approach in order to build Object Orientated Models. Is there some kind of possibility to generate C# code stubs out of the ORMs yet. I think that this is the very missing stone in the whole idea. If we think further the information stored within the ORM would allow generating some kind of a Ralational-Object Mapper code including simple SQL. So if you changed your ER Model or add some new “Facts” you would just generate your ALTER-nation statements for the DB and generate new C# classes including the update of the Relational - Object mapping. Don’t you thing that this is actually the future of how applications will be created?
So long
Pawel
|
|
|
|
|
is it something like ObjectSpaces?
Pawel
|
|
|
|
|
I have created a DataGrid and bound it to a DataSet thus populating it with my data. I have also managed to format the columns the way I want them.
Now I just wonder if there is any way I could get rid of the first column, the one before my DataSet data. I don't know what it is called, but it is where the selection arrow is displayed, and also the plus sign if I have a relation in my DataSet.
Any advice would be much appreciated. I have been looking for a method or property in the DataGrid class to disable this feature, but I have not been successful so far.
|
|
|
|
|
Have you tried setting the RowHeadersVisible = false ?
If you would like to get rid of the row with the '*' on it where it adds new rows, you can use:
dataGrid1.DataSource = myDataSet.theTable.DefaultView;
((DataView)dataGrid1.DataSource).AllowNew = false;
Where dataGrid = your grid, myDataSet = your dataset, theTable = the table you wish to show.
Oh yeah, if you want to get rid of the blank area at the top of the grid that would be the "CaptionVisible" property on the Grid, just set it false.
Rocky Moore
|
|
|
|
|
I have tried setting the RowHeadersVisible property to false, but that did not help. I guess that is only used if row headers are defined, just like with column headers, but I'm not certain.
I actually don't mind being able to add new rows, so that property is ok. I would just like to get rid of the first, non-data, column in the grid. Maybe it's not possible, or maybe it's more difficult than I believe.
Thanks for your effort though, appreciate it!
|
|
|
|
|
I'm sorry, you were perfectly correct about the RowHeadersVisible property. My mistake was that I had tried changing it in the wrong place. Ooops!
|
|
|
|