|
There's no built-in way to do this. There is, however, a way to do this with the ListView control. ListViewItem.BackColor
|
|
|
|
|
Thanks!
I have coded it in the following way:
private void lstBoxSystemTypes_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox listBox = (ListBox)sender;
string itemValue = listBox.Items[e.Index].ToString() ;
e.DrawBackground();
Brush brush = Brushes.Red;
e.Graphics.DrawString(itemValue, e.Font, brush, e.Bounds, StringFormat.GenericDefault);
e.DrawFocusRectangle();
}
But the itemValue (string variable at line 4) contains something like "System.Data.Data". I want the actual value to be painted.
Thanks once again
|
|
|
|
|
Hello! I made it possible in the following way:
private void lstBoxSystemTypes_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox listBox = (ListBox)sender;
string itemValue = listBox.Items[e.Index].ToString() ;
System.Data.DataRowView dataRowView = (System.Data.DataRowView)listBox.Items[e.Index];
e.DrawBackground();
Brush brush = Brushes.Red;
if (bool.Parse(dataRowView["Approved"].ToString()))
brush = Brushes.Black;
e.Graphics.DrawString(dataRowView["Name"].ToString(), e.Font, brush, e.Bounds, StringFormat.GenericDefault);
e.DrawFocusRectangle();
}
But there is another problem: item's color doesn't change when it is selected.
|
|
|
|
|
How to Import Data from MS Excel to DataSet using C#. View them into DataGridView, populate into SQL Server 2000 and BindingData in controls
Learning forever
|
|
|
|
|
tuansara wrote: How to
Indeed! If only the internet had sites where people published documentation and instructional articles and blogs related to issues such as this. And then if only there existed some way to search the internet using key words to locate that type of information.
If only....
|
|
|
|
|
How to Import Data from MS Excel to SQL Server 2000????
Learning forever
|
|
|
|
|
You question is very general, so this will be a general answer: first, get the data out using something like Visual Studio Tools for Office (google it). Then use ADO.NET to insert that data into SQL.
|
|
|
|
|
I have an InfoPath file and want to create an xml file of it using C#.
The xml file should look exactly like the one that would be saved if I opened the form with InfoPath and saved it as xml.
Can that be done somehow with C#?
I've tried to rename the xsn file to cab, extract template.xml and sampledata.xml, but they are nothing like the xml file that is created from InfoPath.
|
|
|
|
|
Start here:
http://msdn2.microsoft.com/en-us/library/bb448854.aspx
Then the following will be useful too.
http://www.microsoft.com/downloads/info.aspx?na=47&p=1&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&u=details.aspx%3ffamilyid%3d8D46C01F-E3F6-4069-869D-90B8B096B556%26displaylang%3den
http://www.microsoft.com/downloads/details.aspx?familyid=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&displaylang=en
|
|
|
|
|
Thanks, it looks interesting.
Are you sure that it works for InfoPath files?
It's a part of MS Office, but it is not listed.
Have you or anyone else done this before?
Would be nice to see some examples on how to make the xml file.
|
|
|
|
|
|
I'll take a look at it.
But I'm not to hopefull that it works with InfoPath forms because according to Microsoft it only works with:
* This download works with the following Office applications:
o Microsoft Office Excel 2007
o Microsoft Office PowerPoint 2007
o Microsoft Office Word 2007
|
|
|
|
|
Hello!
I have a question regarding listviews when using checkboxes. I have created a listview with checkboxes but I have noticed an irritating thing about these: when trying to check the checkbox, it glitches. On some mouse clicks it becomes checked/unchecked and on some nothing happens. This is on ordinary clicking. If I instead click and hold the button for a little longer while it always becomes checked/unchecked.
I have tried this on several computers and with different mouses so that is not the problem.
Has anyone else noticed/gotten this problem?
|
|
|
|
|
No...I haven't run across that error. ...One thing though, have you tried subscribing to all of the available events supported by the ListView? Try that and pop up a MessageBox in each handler that tells you where you are. Your "Checkbox click" is probably getting hijacked by some separate event that supersedes it.
"I need build Skynet. Plz send code"
|
|
|
|
|
Hi All,
How do I Print a web page opened with IE from external application ?
and also if any body knows a good technical documentation about IE, like Object Hierarchy. Please let me know.
Thanks,
Dinesh
_______
|
|
|
|
|
I am tring to replace "\" to "\\".
e.g.
--------------------------------------------------------
string strFName = "";
strFName = Application.StartupPath.ToString();
// Value get by above code is C:\UPLOAD\UPLOAD
strFName = strFName.Replace("\","\\");
--------------------------------------------------------
But this code is not getting compile.
KK
|
|
|
|
|
The slash indicates an escape sequence. If you don't want it interpreted as an escape sequence prefix the string literal with an @, e.g. @"\"
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
Thanks........
|
|
|
|
|
Hi,
I got the following exception error when I debug my .net application in 2005.
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
Actually I am binding the data to gridview. I am sure that the data is there in dataset and binding to gridview. while binding, I am getting the above error.
I have searched in net, I got the solutions like, run in mixed mode (managed and native). I did the same means, I enabled both managed and native code debugging options. But still I am getting the same error. Could you please tell me how can I solve this?
I am using windows 2003 server with service pack 2.
Thanks in Advance,
AR Reddy
|
|
|
|
|
well to be honest I dont have an exact idea of this error but i think you should try capturing the DataError Event of that DGV and see whats happening in that.
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Hi Reddy,
Interesting error! On googling a bit i found that it can be because of the response.redirect method in the catch block!
The response.redirect normallu throws out a thread abortion error so in the catch block it is throwing this error.
Remove your response.redirect in your catch block i guess it should work fine!
If you want to redirect to a specific on an exception use the web.config instead
Hope this helps!
gauthee
|
|
|
|
|
Hi,
I'm trying to find a way to access ACPI from within C#.
I want to read thermal zone _TMP property. I've searched the web, and found references to acpi.sys driver. This should be able to get the thermal information, but I can't find a way how to read it.
Does anyone have any experience with accessing ACPI from C#?
Does anyone perhaps know of some API or so to access the ACPI info?
Any help would be appreciated!
Tim
|
|
|
|
|
|
I've found these pages before, but they seem to be specific for the Notebook Hardware Control application (NHC).
I tried this program, and it can read all information of my system correctly. However I find this application to be much more then what i need (bloated, let's say), so I would like to write my own simple application to read only those values from ACPI that are of interest for me.
The examples given on the site of your first URL show how the NHC app will read the values. There they allow to create source files for your specific system, wich the app will then read and show.
This is not what I want to do. I have my System Description Table (DSDT) disassambled with the intel utility and i know wich values, methods, functions I want to read. What I need to know, but don't seem to find is how to call the methods or read the values from whitin my own application (C#).
I do not want a written out solution on how to read this, only some guidance to the right API calls or whatever needed to accomplish this task.
Anyway, thanks for your help Hessam Jalali and my best regards to you all!
Tim
|
|
|
|
|
Did you ever find a C# solution to read ACPI data for temps, speeds, voltages? Dave Kolb
http://dotnetcodeslingers.com
|
|
|
|