|
If you're using a custom TypeConverter or UITypeEditor , you can attribute the property that is of Type Font . This would take precedence over the TypeConverterAttribute or EditorAttribute that is declared for the class itself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I made type converter inherited from System.Drawing.FontConverter and override GetProperties method.
But GetProperties method of my type converter is never used.
See code below.
//////////////////////////////////////////////////
// class that should be localized
...
[TypeConverter(typeof(LocalizedFontTypeConverter))]
public Font FontProp
{
get { return fontProp; }
set { fontProp = value;}
}
...
// type convertor
...
public class LocalizedFontTypeConverter: System.Drawing.FontConverter
{
public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributes)
{
return GetLocalizedProperties(base.GetProperties(context, value, attributes));
}
// GetLocalizedProperties method is omitted
}
|
|
|
|
|
Did you try putting a breakpoint on your return statement? I've done this in several apps and it works fine, depending on how the containing class is used (if you assign the containing class instance to PropertyGrid.SelectedObject for example).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes, of course. I put breakpoint in my GetProperties method and saw that this method was not called.
Class instance attached to PropertyGrid using
PropertyGrid.SelectedObject = ...
If you say that this should work, it is fine
I will continue trying.
|
|
|
|
|
How can i get the true icons of a file using c#.
When someone enters a whole path (which exist) in a textbox.
e.g. If it is "c:\tekst1.txt", how can i get the file icon. Here it is a plain text icon.
If you enter the path of a ms-word doc. I will get the ms-word icon.
Is there some class availible or need i to read the registry entries in the Classes_root. (when the registry refer to a ico-file this is no problem, but most programs refer to an exe-file.
Thanks
Jonathan Slenders
|
|
|
|
|
|
|
Hello,
Precondition.
1. The ListView control. have 5 columns.
2. This have 70 data.
I would like to remove data after add data on visual.
I could do it. but not visible.
After remove and add data on ListView and ListViewItem, I called Update() or BeginUpdate() & EndUpdate(). But These data didn't update.
The following is the source.
If you have some ideas, please tell me.
regards,
yu-yu
--------------------------------------------------------
lvListView.BeginUpdate();
while(i < lvListView.Items.Count)
{
if (lvListView.Items[i].SubItems[3].Text.CompareTo(sTemp[3]) == 0)
{
lvListView.Items[i].Remove();
break;
}
i ++;
}
ListViewItem items = new ListViewItem("WEB");
items.SubItems.Add(sTemp[2]);
items.SubItems.Add(sTemp[4]);
items.SubItems.Add(sTemp[3]);
lvListView.Items.Insert(lv参加者.Items.Count, items);
lvListView.EndUpdate();
|
|
|
|
|
Our scenario:
Multiple objects being hosted in a Windows services on Win2003 Server.
Up until now, we were running the server as an EXE, but since moving to a service all our errors are being returned as "Server encountered an internal error.".
We last saw this error when our exceptions were not supporting serialisation correctly.
Since changing the exception classes, the error went away and we haven't changed anything else since moving the server code into a service.
The code works 100% and the exceptions are expected, however the type and associated info about the exception is now not being preserved across the remoting boundary.
Is the behaviour of the remoting code different if it's in a service?
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
It shouldn't be (since a service is just an executable that's run by the SCM), but to satisfy curiousity (and hopefully help you solve the problem), have you tried checking the Exception.InnerException to see if you are getting what you expected?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
<br />
private void btnPrevious_Click(object sender, System.EventArgs e)<br />
{<br />
txtAcctID.Clear();<br />
<br />
if (Row == 0)<br />
{<br />
MessageBox.Show("You are at the first patient on the Queue","Beginning Of Queue");<br />
Row = 0;<br />
<br />
}<br />
else<br />
{ <br />
Row = Row --;<br />
txtAcctID.Text= dsPatDia.Tables["PatDia"].Rows[lastrecord]["Acct ID"].ToString(); <-- ERROR! <br />
}<br />
<br />
if( Row == 0)<br />
{<br />
try<br />
{<br />
oleDbConnection1.Open();<br />
<br />
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT Results, Tests, Symptom FROM Dianosis WHERE [Acct ID]= '"+txtAcctID.Text+"'";<br />
<br />
oleDbDataAdapter1.SelectCommand.ExecuteNonQuery();<br />
<br />
oleDbDataAdapter1.Fill(dsDiag2);<br />
<br />
Display(dsDiag2);<br />
}<br />
catch (Exception ConnError)<br />
{<br />
MessageBox.Show(ConnError.ToString());<br />
}<br />
<br />
}<br />
<br />
}<br />
<br />
private void Display(System.Data.DataSet dsDiag2)<br />
{<br />
oleDbConnection1.Close();<br />
try<br />
{<br />
System.Data.DataTable PrevDiag = dsDiag2.Tables[0];<br />
<br />
if(PrevDiag.Rows.Count != 0)<br />
{ <br />
txtResults.Text = (string) PrevDiag.Rows[0][3];<br />
txtTests.Text = (string) PrevDiag.Rows[0][4];<br />
txtSymp.Text = (string) PrevDiag.Rows[0][5];<br />
}<br />
else<br />
{<br />
MessageBox.Show("The Patient Record does not exist","Information");<br />
dsDiag2.Clear();<br />
}<br />
}<br />
catch(Exception Error10)<br />
{<br />
MessageBox.Show(Error10.ToString());<br />
}<br />
}<br />
An unhandled exception of type 'System.NullReferenceException' occurred in CLINICINFORMATIONSYSTEM.exe
Additional information: Object reference not set to an instance of an object.
how do i rectify this prblem..i want the textbox to display the id of the record before the current one.?
CODER
|
|
|
|
|
There are at least two things you want to check out:
1. You probably forgot to fill the dataset before you call the methods (or even declared it as new).
2. The table does not exist, the column does not exist, or there are no records in the table.
How did you get the lastrecord variable in Rows[lastrecord] anyway?
Edbert P.
Sydney, Australia.
|
|
|
|
|
Hi ,
Find the exact line it occers. it says your object(may be oleDbConnection1 ) is still null, but your going to call its method.
D!shan
|
|
|
|
|
Hello,
most programms using a mdi container have a tabcontrol like panel showing all open windows for a fast switching. is there any avaible control for this, or dokumentation how to build such a feature?
thanks
|
|
|
|
|
Not provided in the FCL (.NET Framework Class Library), no. There are many third-party controls out there that do this, however, like .NET Magic Controls[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey
i Got a Access data base file that i whant to open in C#, i use the folowing code
<br />
<br />
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=testdb.mdb");<br />
using(conn)<br />
{<br />
OleDbCommand com = new OleDbCommand("SELECT Medelande FROM Medelande",conn);<br />
using(com)<br />
{<br />
OleDbDataReader r = com.ExecuteReader();<br />
using(r)<br />
{<br />
this.txtBoard.Text = r["Medelande"].ToString();<br />
}<br />
}<br />
}
It says "ExecuteReader requires an open and available Connection. The connection's current state is Closed."
The file is in the projects dir and the file is named testdb.mdb .
Why is this not working? do i have to start a SQL Server? I have One SQL Server installed, but how do i get this server to know that i what to use this testdb.mdb?
And how do i rewrite the code so it takes contact with the SQL server instead?
//Jimmy
|
|
|
|
|
Hi...
Try using this:
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\mypath\\myDB.mdb");<br />
<br />
OleDbCommand com = new OleDbCommand("SELECT Medelande FROM Medelande",conn);<br />
<br />
conn.Open();
<br />
OleDbDataReader reader = com.ExecuteReader();<br />
...<br />
...<br />
<br />
conn.Close();
|
|
|
|
|
|
It workt well =)
But now i have an other problem
OleDbCommand com = new OleDbCommand("INSERT INTO Medelande" +<br />
"(id, Medelande) " +<br />
"VALUES (2,'kalle')", conn);<br />
int i = com.ExecuteNonQuery();<br />
this.txtMessage.Text = i.ToString();
It says that i need to use a qustion that can update?? what do the mean with that?
And if ID is i counter i could live it out right? it will get a value by the counter
//JImmy
|
|
|
|
|
If you have an AutoNumber as a field type, you shouldn't include it in your INSERT or UPDATE statements.
Also, don't use string formatting like that. Learn to use the OleDbParameter , which takes care of escaping all values for you and can perform type-checking (as far as databases go) on the client as opposed to submitting the query first to get an error back from the server. This is by far a better way and makes executing batch statements easier (since you create your statement and declare the parameters once, then just change the parameter values and execute the statement with each iteration). See the documentation for the OleDbParameter[^] class in the .NET Framework SDK for more information and examples.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi everyone,
I was hoping the following code would produce a DataGrid which sorts numbers as numbers (not as strings).
DataSet myDataSet = new DataSet();
myDataSet.ReadXml(fileName,XmlReadMode.Auto);
myDataSet.ReadXmlSchema("Data.xsd");
dataGridDaSData.DataSource = myDataSet;
But '10' is listed before '2'.
[fileName is passed;
Data.xsd was created by Visual Studio and corrected by me to require doubles;
Do I need the third line? - the xsd is listed in the XML...]
Any ideas?
---
|
|
|
|
|
If you've created an XML Schema in VS.NET, you should make sure that the IsDataSet option in the property grid (when the designer is open for the schema) is set to true. If you do this, you can generate a typed DataSet class which may resolve the situation (since all tables, rows, and fields are typed according to your typed DataSet schema.
Also note that a DataSet (and hence the DataGrid which has a view on the DataSet ) is not sorted by default (though, if your records were sorted to begin with, it may appear to be sorted). To sort, get the DataView from the table in question and set the Sort property according to the documentation. Use that view as the DataSource for your DataGrid . This is one way to solve the problem, so long as the DataSet recognizes the column as a number rather than a string. Again, using a typed DataSet should help solve the problem (and makes your code easier to write and faster since fewer lookups are required when you use the typed properties in your code).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
First off, thank you for your reply.
Secondly, sorry for such a late response.
Thirdly, my data comes from an XML file, so there is no DataView in use - will that affect my ability to sort it? Should I have a DTD inline within the XML?
Regards, J
---
|
|
|
|
|
I need to incorporate an unmanaged C++ dll into my C# application. I need to be able to create an object specified in the dll and call some methods on it. The documentation I have points me towards the System.Runtime.InteropServices namespace, but is not very clear. Can anyone tell me how to do this?
Thanks, G
|
|
|
|
|
i was struggling with that for a long time.
have a look here: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20889520.html#10405890
a question of mine on EE
Hope it at least helps a bit.
---
|
|
|
|