|
One what like do you get this? Debug your application and find out exactly where the error is happening.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I draw on a nonclient area of a form ? I mean the border and the caption. Before I started using C#, I just used WM_NCPAINT message to do the job, but I have no ideas how to do it in C# now ? Can anyone help me ?
Also, how can I get the size of the nonclient area ?
Regards, Desmond
|
|
|
|
|
Maybe I somehow have to import a some procedure form Win32 API, using DLLImport attribute ?
|
|
|
|
|
Override WndProc and continue to use WM_NCPAINT . In your handler, you can get a Graphics from several means, such as Graphics.FromHwnd , passing the HWND (an IntPtr ) that you get along with the Message that you're handling in WndProc .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks, but it's a bit hard for me to understand this. Could you please support me with a basic code example ?
|
|
|
|
|
You do just like you did in C++, only using managed code. If you need examples, try http://www.google.com[^]. There's many examples out there I've seen in the past.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Did so -> problem solved. Thanks. Note that I actually didn't came from C++, but from Borland Delphi (it's not that bad, really).
|
|
|
|
|
Hi guys,
I think it's a simple question: I connect to a MySQL database with OdbcDataAdapter and besides the data I want to get the schema of the database directly from the database, so I use something like this:
public DataSet GetData()
{
DataSet ds = new DataSet(datasetName);
OdbcDataAdapter adapter = new OdbcDataAdapter();
adapter.SelectCommand = GetSelectAllCmd();
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.TableMappings.Add("Table", tableName);
adapter.Fill(ds);
if(ds.HasErrors)
ds.RejectChanges();
else
ds.AcceptChanges();
adapter.Dispose();
return ds;
} Everything seems working fine, but the schema isn't transfered correctly. The MaxLength property of the DataColumn member has the value of the longest entry in the database. For example if there is a column called 'name' and the database has an entry like 'John' the MaxLength property is 4. But I specified the 'name' column to allow 100 chars while creating the table (... name VARCHAR(100) NOT NULL, ...).
Furthermore I'm not able to change the MaxLength property. The following has no effect:
ds.Tables[tableName].Columns["name"].MaxLength = 100;
So I'm not able to insert a name to the 'name' column that is longer than 4. I get the error "The value violates the MaxLength limit of this column". Many thanks in advance!!!
Regards, mYkel
P.S.: Sorry I also posted this in SQL/ADO/ADO.NET forum but perhaps it fits better here...
|
|
|
|
|
The schema that you get is relative to the result set. If you want to have a specific schema that matches your tables, I suggest you create a typed DataSet by using either the xsd.exe utility that ships with the .NET Framework SDK to create a typed DataSet class from an XML Schema, or add a new DataSet class in Visual Studio .NET and either re-create your tables (and optionally your keys and relationships), or drag and drop your tables from the Server Explorer after adding a connection object to your database.
Use that typed DataSet in your OdbcDataAdapter calls (like Fill ) and in your queries. If you're using the designer in VS.NET for a DataGrid or some other data-bound control, it gives you nice design-time support for specific table names and columns. If also provides faster access to data when using the typed table and column names because they reference the DataTable and DataColumn objects directly, instead of using a string name that requires several looks ups.
If you don't want to use a typed DataSet , you can also add a columns to your TableMapping property. See the DataTableMapping class and its ColumnMappings property documentation in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I got it working with a typed DataSet ... thanks very much for your help Heath!!! You're the best!
Regards, mYkel
|
|
|
|
|
Hello guys!
I've seen the samples here and I have a few questions:
1 - Is it possible to download the messages with a component and onde they are downloaded I
can't download with outlook?
2 - Can I save the messages in a archive like a pst?
Greetings,
Agus
|
|
|
|
|
|
Hello,
I would like to use the NUnit Framework on GUIs.
Currently I´m using an instance of my form to get all controls. I am then filling some textboxes and push some buttons and 'assert' for errors. But this isn´t working anymore as soon as a modal dialog pops up.
Are there any tools for .NET to do this (like Abbot for JUnit)?
|
|
|
|
|
Simple: How can i use windows API in C#
|
|
|
|
|
Simple: Declare the functions using System.Runtime.InteropServices.DllImportAttribute.
[DllImport("user32.dll")]
private static extern IntPtr GetDC(IntPtr hWnd);
|
|
|
|
|
Hi
I have a problem with type casting . I have the string which is the name of one control(HtmlTable) . I know the control I want to type cast the name as the control.
I tried the following and I get "Invalid Casting ! "
string TableName = "Table1";
(HtmlTable)(TableName)
and
(HtmlTable)((object)(TableName))
Thanks
|
|
|
|
|
Do you know the container of the control? Then you can find the name in the Controls colleciton:
HtmlTable myTable = null;
foreach(Control ctl in container.Controls){
if(ctl.Name == tableName){
myTable = (HtmlTable)ctl;
break;
}
}
If you don't know, where the control is, you can find it "by name":
String tableName = "Table1";
Object ctl = null;
System.Reflection.FieldInfo info = this.GetType().GetField(tableName);
if(info != null){
ctl = info.GetValue(this);
}
HtmlTable myTable = (HtmlTable)ctl;
|
|
|
|
|
Or by referencing the container control, you can use FindControl , passing the name. Cast the return (after checking for null ) to an HtmlTable then.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks that really helped
|
|
|
|
|
How can i convert an xml file to html file. Actually i want to provide the xml file and xsl file to the function and it will give me a file with .htm or .html extension.
Thanx in advance
Regards
minamkhan
Inam
|
|
|
|
|
Take a look at this example:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=64
M tti s
|
|
|
|
|
|
|
I don't quite understand what dispose method exacly does. From manual I read that it "frees up ny ressources being used". But what happens to the object after calling dispose method ? Is it destroyer ? Also - is there any link between an object's destructor and dispose method ?
Regards, Desmond
|
|
|
|
|