VB.net: highlight full row without affecting cell backcolor - vb.net

datagrid
hi guys, Good day! I'm doing a ticketing system with color code in 1st and 2nd column in my datagrid. My question is, how can I fullrowselect my datagrid without affecting the back color of my datagrid in 1st and 2nd column. Please see my image sample

dataGridView.DefaultCellStyle.SelectionBackColor is used to control this color. So set that to your prefered colors. There is more information on this here: https://msdn.microsoft.com/en-us/library/1yef90x0.aspx
You may need to do it dynamically if you're customizing the background colors so you could handle the CellFormatting event and make the changes in there.

Related

Changing the selection of RadioButtons in a GroupBox within a DataRepeater will change the selection of other RadioButtons

I have a DataRepeater in which I have a Label (LabelID) and a GroupBox which contains RadioButtons. I am binding the Labels to a column from a DataTable and what I wish to do is to give the user the chance to select one of the Radio Buttons within each cell of DataRepeater and then upon progress I wish to read the user's selection for each cell. The problem is that when the user starts selecting the radio buttons and scrolls down to select radio buttons for other cells within the DataRepeater, the previous selections change or even the ones that user has not selected yet get selected. I have no idea why this is happening.
Here is the code for what I have done:
LabelID.DataBindings.Clear()
LabelID.DataBindings.Add(New Binding("Text", SomeDataTable, "SomeID"))
myDataRepeater.DataSource = SomeDataTable
I added the GroupBox which contains the RadioButtons in the Visual Studio drag and drop framework.
I tried the following binding as something that I thought might solve the problem, but it did not.
GroupBoxSelection.DataBindings.Clear()
GroupBoxSelection.DataBindings.Add(New Binding("Tag", SomeDataTable, "SomeID"))
I know it has something to do with scrolling the DataRepeater up and down. Because I increased the size of the DataRepeater to get rid of the ScrollBar and this strange behavior won't happen anymore. I cannot keep the DataRepeater that big so I would like to find another solution.
Any help will be appreciated?
I don't know how the DataRepeater works exactly but I wouldn't be surprised if it reused controls to increase performance. If so then your controls may be retaining their values as they are moved. What you might try is creating a user control to contain the RadioButtons and expose a single property that you can then bind. If an instance gets reused then the binding should update correctly as it does for the other controls.

listbox column head format backcolor

I need to set the entire column head in the list box to bold
and color. So I created a list box, and in the list box property under
column heads I selected yes, how can I make this list box bold without
effect the rest of the data in the list.
You can't do it as far as I know. The only alternative I can offer is a method I use. You make your list box wide enough that it doesn't scroll horizontally and put labels right above it.
Remember to leave the last column a little wider than you need to account for the scroll bar.

How to skin the UITableViewCell image used when selecting multiple rows?

When you put the cell in edit mode and allow multiple cells to be selected at once, the UITableView shows a checkbox on the left of the cell, like below.
How do I change that image? Changing the cell.editingAccessoryView just adds another accessory to the right, instead of changing the left one.
Apologies for reading the question wrong at first. Best I can find at the moment is the multiSelectCheckmarkColor property on the tableview. This technically isn't what you are asking for... however, if simply changing the color is a sufficient solution for you then you might be interested this option.
The only working solution I know is not using the default editing mode at all.
You can easily add a custom checkbox to your cell and animate the cell to show it when entering editation mode.

In VB.NET, can we draw empty lines instead of blank area in non existent row of datagrid?

EDITED:
I think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. :)
Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel.
Can we achieve this using VB.NET design time property?
And also, we must not trigger the display of vertical scrollbar this way.. :)
Thanks
You might try doing a screen capture of the dgv when it is full of blank lines and use that as your background. However, you'll have a problem with the vertical lines if they resize the columns. In your picture you don't have any vertical lines so if you don't need them then just erase them and your problem is solved.
There's also the option of using the Virtual Mode. When you set that property to true then you can set the number of visible rows, but you are responsible for telling the dgv what each individual cell is supposed to contain: http://msdn.microsoft.com/en-us/library/2b177d6d.aspx
Or you can just add extra blank rows to whatever datasource you are setting your DGV to.
Use the ScrollBars property to turn the vertical scroll bar off.

DataGridView Scaling

In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One DGV takes up the whole bottom half of the form. The other two share the top half and are side-by-side.
I'd like to have each DataGridView scale appropriately. More specifically I'd like to have column widths and row heights adjust to the size of the form. Then I'd like the cell font to auto-fill based on a change in the cell size.
I've used the Dock property for the controls to scale to the size of the form. How can I get the rows and fonts to utilize the increased form size?
Thanks.
You can use the datagridview.autosizecolumns and the datagridview.autosizerows to autosize the columns and rows. Look at ColumnHeadersDefaultCellStyle, rowHeadersDefaultCellStyleand RowsDefaultCellStyle to change the font
As for changing the fontsize, I don't believe there is any automatic way to handle this. You'll just have to write some code to change the font size based on the size of the datagrid.