|
Hi,
this[^] is the simplest example I have on colored listbox items.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
All items the same color? Or different colors for different items?
If the latter and the ListBox won't do it, maybe try a TreeView instead.
|
|
|
|
|
The color off the text wil be the same as shown in the combobox.
for ex:
textbox - "Hello World".
combobox - Red.
When i press the button the listbox will show the line "Hello World" in red.
|
|
|
|
|
IMO that did not answer the question: if you choose red and click the button, then choose green and click the button again, would the ListBox now show two lines using different colors?
I understood it would, and that is what my earlier example does too.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
But i still dosen't understand how to combine the click event with the
DrawItem event.
Can you please explaine me this?
|
|
|
|
|
Hi,
you don't have to worry about the firing of the DrawItem event, it basically works like the Paint event of any Control, i.e. it gets fired by Windows when (part of) the Control needs being redrawn because something happened (a Window on top of it has been removed, the user caused a scroll, whatever) OR your program told the Control something has changed (by calling Refresh or Invalidate).
So make sure the content of your Control is what you want it to be, e.g. on a button click, add an item to the ListBox.Items collection. And if something changes without the control knowing it, tell it to redraw with Invalidate().
Did you look at my example at all?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
It working...
Thanks
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
how i can get a volume serial number by c# language ?
|
|
|
|
|
By using the <a href="http://www.eggheadcafe.com/articles/20021019.asp">GetVolumeInformation</a>[<a href="http://www.eggheadcafe.com/articles/20021019.asp" target="_blank" title="New Window">^</a>] API.
|
|
|
|
|
That is a soft number, the doc says "This function returns the volume serial number that the operating system assigns when a hard disk is formatted." Not the real stuff.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
You're right
I just saw the keywords "volume" and "serial" and didn't stop to read the question.
Kafein
|
|
|
|
|
Hi,
there are two serial numbers:
- a soft one, created by Windows when formatting a partition; that's what GetVolumeInformation would return.
- a hard one, set by the manufacturer, and read-only afterwards. There are a couple of ways to get it, one through WMI, one through direct device I/O with CreateFile and ReadFile; both of these require admin with elevation under Vista (and probably all future Windows versions).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
What would you do with it? Most things involving getting hardware serial numbers are pure evil..
|
|
|
|
|
I have written an application where a user can select some parameters using a windows form. The app grabs data from various tables and amalgamates them into a single table. I have also created a dataset with the same columns as the amalgamated table. I created a new crystal report and added the table in the dataset as its datasource. I dragged the columns onto the report.
At runtime, I fill the table, then set the report's datasource to the amalgamated table like below:
EmployeeReport rpt = new EmployeeReport();// This is the crystal report
rpt.Database.Tables(0).SetDataSource(data); // data is the amalgamated table filled at runtime
Then I set the CrystalReportViewer control's source as below
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.ReportSource = rpt;
However, none of the fields are shown in the report except for the layout which I created at design time using boxes and labels etc.
I have been searching and googling but no luck
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
I don't believe it! No one here has an answer! Come on I need some help!
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
are you saying that the fields you dragged onto the report aren't showing at runtime?
Have you done a viewer.DataBind(); after setting the reportsource?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
viewer.DataBind() is not an available method on CrystalReportViewer control. This is a desktop application, not a web application. Basically what I am trying to do is as following, for example:
I have created the layout of the form for customer orders. Each order should be on a separate page but the layout will be consistent. I grab the data using many stored procedures and then put them into one table (TableAll for example). I have also created one dataset with one table (TableDataSet for example), at design time, which has exactly the same structure as TableAll. I set the crystal report's datasource to the TableDataSet by using Database Expert (Right click the Database field). I drag the fields from the Database fields onto my report.
At run time, my app populate DataAll and I set the report's table (TableDataSet) source to DataAll as below:
OrderReport report = new OrderReport(); // Crystal report
// The first table of the report gets its data from DataAll, they have same structure
report.Database.Tables(0).SetDataSource(DataAll);
// Create the viewer
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.ReportSource = report;
viewer.Visible = true;
The report however only contains the layout but no data. Why do you think?
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
when I googled I found that 'var' in .Net is used if .NETFramework3.0 is there, IS there any variant datatype in c# for using in vs2005 in similar way.
|
|
|
|
|
var in 3.5 practically means "Deduce the variable type at compile-time", so, for converting code to 2.0 you have to substitute var with the right type for all variables.
For example,
3.5
var i = 0;
var s = "Hello"; in 2.0 becomes
int i = 0;
string s = "Hello";
|
|
|
|
|
Var was added for Linq.
You must be abusing var , don't. Just use the type.
|
|
|
|
|
var is a language feature introduced in .NET so that C# can follow in the popularity of VB6.
object would be the closest charlie foxtrot counterpart available in 2.0.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: object would be the closest charlie foxtrot counterpart available in 2.0.
It will take quite a twist to make this work:
object a=1;
object b=2;
object c=a+b;
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Closest counterpart does not imply identical functionality. Personally I am completely opposed to the var construct.
|
|
|
|
|
Right. I haven't used var (nor LINQ), and I don't intend to.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|