Need some help to know if there's anyway to do what i'm trying to do...
I have a big datagridview that has a list of items, that have several states, every state has a date. My dgv will look like this:
----- Date1 | Date2 | Date3 ...
It1 |
It2 |
It3 |
The same item can have multiple states in the same date, for example:
The item1 enters the factory in the date1, and leaves the factory in the same date1, what i need it's that the intersection cell, have one line with the background in green with an F (means that the item enters in the factory), and in the same cell, but in another line (multiline) in the same cell i need another F but this time with the background red (means that item leaves the factory).
The usuals columns doesn't allow me to do this, i created a simple code to use a image column and then draw a image that does what i want, but i don't like the final results and it's a little slow, and when i select the full row, i don't have the usual selected cell visual effect in this columns...
I was thinking to create a datagridview column with a different type (inherited) but i don't know what column to use as base column for my column, image column and then paint the content of another control in the cell or another type?
If anyone have or know some way of doing this please tell me?
Thanks
Rate People That Helped You Mark Thread Resolved When Resolved
Here is something that might assist. It's not what you want but in a different order, food for thought.
The concept is that if the first column of the custom DataGridView does smart repeating values which means if the values were
1 A
1 B
1 V
2 D
2 C
You see
Code:
1 A
B
V
2 D
C
I uploaded the project w/o the XML data so there are in two zip files, simply place the XML in the debug folder and alter the path for reading the data in the form.
Hope this helps in some way
Last edited by kareninstructor; Jul 9th, 2011 at 10:13 PM.
Thanks for the reply and the code... It may be useful in the future (other projects), but for me in this case i can't apply it, first the structure of the database doesn't allow me to do that, and then it will duplicate some much rows that visually it will be very confusing for the user...
I'm thinking for now, create some kind of method to resize and write text according to the number of the lines and the available space in the cell, or just create some image with a default size and adjust the image to the cell...
BTW, do you know some kind of grid or custom dgv that can be manipulated like the dynamic tables in excel?
Thanks
Rate People That Helped You Mark Thread Resolved When Resolved
I want to have multiple colors in the same cell, for example:
Line1 (color red) - state done
Line2 (color red) - state done
Line3 (color green) - state current working
Line4 (no color) - state next job
For testing purposes i defined the columns has image columns, but now i have a big problem...
The dgv layout it's like the attached image, and after filling the data of the first columns until the black separator, i add the date columns manually (the interval it's defined in the options) and they are image columns, for each row in the table i need to see when it arrives to each state and when it ends that state, but by the way that i'm doing this, it's a very slow proccess...
After filling the data:
vb.net Code:
For Each row As DataGridViewRow In DataGridView1.Rows
checkStates(row)
Next
CheckStates:
vb.net Code:
Dim dr() As DataRow = dtPF.Select(String.Format("idPF={0}", row.Cells("idPF").Value))
If CBool(dr(0)("State1")) = True Then
row.Cells(CDate(dr(0)("DateState1")).ToString("dd.MMM")).Value = IMGGP() 'Return the correct image
If CBool(dr(0)("State2")) = True Then
row.Cells(CDate(dr(0)("DateState2")).ToString("dd.MMM")).Value = IMGF() 'Return the correct image
End If
End If
End Sub
Some info to speed up this process?
THanks
Rate People That Helped You Mark Thread Resolved When Resolved
If i filter the datatable it takes arround 13 seconds to run 300 rows, if i query the database directly and use the row directly it takes less then 1 second...
Rate People That Helped You Mark Thread Resolved When Resolved