I forgot: It's a Windows.Forms application. So i can't do it in that way. But in Websites it's also a solution.
C Scharbe
Posts
-
Style of a DataGridView.Row by using DataSet -
Style of a DataGridView.Row by using DataSetIn that way i currently solved it:
private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { int i = 0; try { dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White; if (dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString().Contains(textBox1.Text)) { dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.ForestGreen; } int ii = 1 / i; } catch { } }
I used the RowPrePaint event. So everytime when the row will be painted there is a check if the BackColor should be changed. I tested it with 1,000,000 rows in fullscreen and the performance is (not the best but) ok. But if you have another solution, feel free to post it. -
Style of a DataGridView.Row by using DataSetThe following code shows you how I created a DataSet and added it to the DataGridView. To define the default column style, I added 2 columns to the DataGridView before and set their DataPropertyName.
DataSet ds = new DataSet(); ds.Tables.Add(); ds.Tables[0].Columns.Add("a"); ds.Tables[0].Columns.Add("b"); colColumn1.DataPropertyName = "a"; colColumn2.DataPropertyName = "b"; for (int i = 0; i < 10; i++) { ds.Tables[0].Rows.Add("a" + i, "b" + i); } dataGridView1.DataSource = ds.Tables[0];
Now I have the problem that I can't change any style (BackColor) of the rows that will be added by setting the DataSource. Can I define it somehow in the DataSet (DataRow) OR is there any event that will be called after the row finished adding? [I don't want to go through each row after the DataSource is setted and set the new style]modified on Friday, June 5, 2009 3:33 AM
-
ListView.SelectedIndexChanged fired too muchDoes anyone have an idea, to solve this problem??
-
ListView.SelectedIndexChanged fired too muchSo there is minimum a
throw new Exception("The method or operation is not implemented.");
implemented :)!! -
ListView.SelectedIndexChanged fired too muchWhat is DWIM? Tell me more :) Or send me a link....
-
How to bind a list to a comboboxThe combobox run ToString() for each item. If you have a class, that does not override the ToString() method, it returns the name of the class- type. I guess you don't need to run
cmb_rues.DisplayMember = ...
?? -
How to bind a list to a comboboxTry this:
class Rue { public int Id; public string Nom; public override string ToString() { return Nom; } };
-
ListView.SelectedIndexChanged fired too muchIt's too complicate... ... for the user to click an extra button :) I missing something like LastSelectedIndexChanged or AfterSelectedIndexChanged.
-
How to bind a list to a comboboxI think you need to write:
cmb_rues.DataSource = Rues; cmb_rues.DisplayMember = "Nom"; cmb_rues.ValueMember = "Id";
-
ListView.SelectedIndexChanged fired too muchI am using the ListView.SelectedIndexChanged to update data, when a new item has been selected. My problem is, that the event will be fired for each new selected (de-selected) item (if multiSelect is true; more than twice). [And i don't want to get the data from the database each time.] Is there an event that will be raised if the control has finished handling these processes (or processes for this control at all)? Or does anyone have another idea to solve thsi problem
-
Items in ListView changed [modified]I also tried to inherit an own class from ListViewItemCollection and raise a Changed event if any item were added or removed, but i don't know how to set the inherited class to the ListView.Items collection. Therefore i inherit an own ListView2 from the ListView class and tried to set the Items:
base.Items = new ListViewItemCollection2();
But base.Items is readonly... -
Items in ListView changed [modified]Is there an event that raise if the collection of ListViewItems in the ListView has been changed?
modified on Tuesday, February 19, 2008 11:22 AM
-
Get Current Working Direcotry/FolderYou get the directory with:
AppDomain.CurrentDomain.BaseDirectory
Greetings -
ClickOnce - Change ProcessorI hope i am in the right group. I have the following problem: I deployed an application by ClickOnce (files have been created by MageUI.exe) and selected the processor type x86 (because the application was builded in x86 mode). Now I changed the processor of the application to Any CPU and also the processor mode of the ClickOnce files to msil (by MageUI.exe) As I deployed the msil files to the same Website where the x86 files have been earlier and run the application link (in Start menu) on the client, I got an error. In the error description I read that the files aren't valid anymore. The link on the client (in Start menu) has the following data http://localhost/x86/MyApp.application#MyApp.app, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx, processorArchitecture=x86 So the problem is that there is a fixed processor Architecture setted. Can I change the processor type in ClickOnce without removing the old application in the client? Does anyone have an idea? Thank You
-
IDeviceContext OR How to MeasureText out of the Paint EventSolution:
IDeviceContext deviceContext = this.CreateGraphics();
ARTICLE AT: Friday, April 28, 2006 Calculating Size of Multi-Line WinForm Label With MeasureText http://geekswithblogs.net/paulmehner/Default.aspx -
IDeviceContext OR How to MeasureText out of the Paint EventHello, I'd like to Resize a control that contains any text. If I use TextRenderer.MeasureText there is always a Padding, also if I use the Flag NoPadding:
Size size = TextRenderer.MeasureText("dddd", this.Font, new Size(Int32.MaxValue, Int32.MaxValue), (TextFormatFlags.NoPadding));
I found out that i need to set a IDeviceContext like that:private void MyControl_Paint(object sender, PaintEventArgs e) { Size size = TextRenderer.MeasureText(e.Graphics, "dddd", this.Font, new Size(Int32.MaxValue, Int32.MaxValue), (TextFormatFlags.NoPadding)); }
My Problem is: I dont want to Resize the Control in the Paint-Event, so I guess I need to get somehow the current IDeviceContext, but how? Or do I use the TextRenderer.MeasureText method in a wrong way? Thank You for Your Answers! -
FileSystemWatcher vs. Own file system pollingYes i already do so, but i think: 'is this mix good?', isn't it better only to poll the file system instead using the file system watcher?
-
FileSystemWatcher vs. Own file system pollingCan any body tell me the advantages and disadvantages of both kinds to get to know if a file is in a specified directory. I have a directory in the network and a application that should work with the file took into the directory. I try to do it with a FileSystemWatcher, but the problem is, if the network connection failed, the FileSystemWatcher did'nt react if the network directory is already available. So i need to reinitialize the FileSystemWatcher in a while again. But i also heard to poll the file system isn't a good idea because it slows the cpu down. (Is it more than the FileSystemWatcher? Can anybody suggest (a good loop time for) polling?) Thank You for your suggestions...
-
Form.Show() and TabControl tab page changedDoes anyone have another idea?