I have a Windows Form application where I need to represent in a DataGridView or ListView a list of items which consist of two label and an image. The text of the labels and the image depends on the property values of the object which the row refers to.
Reading many topics it seems that it's easier with the DataGridView defining a new type of column. I followed this topic and this ones but I can't reach the desired output.
Do you have any suggestions or idea?
Thanks!
I dont know how to bind two controls from different wpf windows (for example: textbox from mainwindow and textblock from window1).
I`ve been looking for any example for ages, but my attempts are in vain. Please, send a link with an example of this or write code..
any help will be appretiated
p.s. sorry, my english is bad.
I don't think there is a way to directly bind 2 controls from different windows but you could use the Datastore for this, open your project in Blend and follow these steps:
Step 1. Add a window to your project and name it whatever you want.
Step 2. Add a Textbox control to your mainwindow and to the new window you created.
Step 3. go to the "Data" window and pick "Create data source" \ "New Data Store".
Step 4. the new datastore you created is added to your project with 1 field now named Property1, by default blend adds a text string to that field "value" you'll need to clear that one out, click on the "Edit data store values" and clear anything in the value field.
Step 5. now all you need to do is to bind both textbox's text property to that datastore field, check this image:
https://postimg.org/image/8nz5xki13/
I am developing several dozen reports in SSRS 2008 R2. I am finding the formatting of cells to be the most tedious and error prone part of the task. I know how to individually format each cell.
Is there a way to copy the format of one cell to many other cells?
I would like to avoid doing search and replace in XML, but I am open to it. My dataset queries are parameterized MDX.
Is it possible to format an entire column at once? Or do you always have to format each individual textbox in a column? Is there a way to specify default formatting for each textbox?
Working on the assumption that you're right-clicking each Text Box and using TextBox Properties to edit the formatting options:
If you go to the View menu in BIDS and select Properties Window, you will get access to all properties of each object at once (in my BIDS it displays below the Solution Explorer on the right).
Assuming you're talking about a Tablix control within a report here, You can format an entire column simply by clicking the column header and editing the formatting options in the Properties Window.
When it comes to say 4 or 5 cells together but not an entire column/row, you can shift-click to allow you to format multiple cells in one go.
I.e. click Cell 1, hold down shift and then click Cell 4. The Properties Window will then let you edit all the cells in the selected range.
Riffing off of GShenanigan's answer, it depends on what you mean by formatting. If it's things like color, font, etc, then you could define a variable, set it to the value that you want, and then set the value of the property for the cell(s) to the value of that variable. For instance, let's say that you're going to set all of the cells' font to Courier New. You'd define a variable called "Font", set it to "Courier New", and then for each cell that you want to have this font, you'd set it's value using an expression which evaluates that that variable's value. Then, when the requirements change and all of those cells need to be Arial now, you change it in one place (the variable) and all the formatting changes.
My solution was to highlight all cells in the table that I wanted to change. Then click View to display the Properties box. Go under the Properties box, in the Number section and change the Format. This worked and reformatted all cells as I wanted.
As a note, I had to paste in the format that I wanted from one of the cells that I had already changed.
Steps:
1. Format one textbox with your desired format
2. Select that cell and check its property window and in "Format" area you will see some code
3. copy that and select other textboxes you want to format with same format.
4. paste the copied value in format area of these newly selected textboxes.
5. Finished.
Highlight cells you want to change and set the font using the Report Formatting toolbar. This worked for me after not being allowed to type in the Properties side pane and having the Properties option disabled on the context menu.
You can format a column or a row depending on what conditions you will require for the formatting.
Let's look at the different scenarios (assuming you are using Visual Studio /BIDS:
If all your columns or rows use similar conditions for formatting
you can select the entire row or column => go to properties window => write an expression for the formatting
If a portion of your columns require use similar conditions for formatting, you can pick those columns by using the control key and clicking on these columns and apply the formatting as explained above
If each cell's formatting is based on individual conditions (e.g., you evaluate the data from that cell to format that cell), you either format particular cells or write an external script code
I want to create a table representing data I have, but I want each row to have a custom display. I have developed a little custom control that represents a row and has a few items in it (text box, check box, progress bar), however how do I now in the main form create multiple instances of this for the data I have?
e.g. is there a winforms control I can use to do this? or do I have to take a panel or something and programmatically do it?
I do need to somehow take responses back. So if someone clicks on the button in the 4th row say then I'll need to be able to tell which row it was from.
As an aside would then be a way to BIND the above mentioned visualization of my data to the data itself, say housed in an Array?
thanks
I see two options here:
You can use a DataRepeater. This control can be found in the Microsoft Visual Basic Powerpack. It allows you to place controls on a template which gets copied for each item in the databound collection.
You can create a custom control and manually place one instance of it for each item in a collection, re-creating databinding for the controls in it. This requires you to either expose the controls inside publicly or as properties of the user control.
However, above options are mostly useful for non-tabular data. If your layout is strictly tabular (i. e. rectangular cells in a grid) then you can create a custom DataGridViewCell which takes some time to understand but not too much code. Putting a progress bar into such a cell shouldn't prove too difficult.
Begginer's question. I'm trying to write small piece of code in Visual Studio (VB.net) that will change value of a particular field of the database for all highlightetd rows. So, I'm running my form, which displays some data from the datatabse. I then highlight some rows (holding Ctrl and clicking). Next I click a button that will trigger a value change for all the highlighted rows (only). Say, I want to change the "Name" column's value for all of them.
Hope this makes sense. Thanks!
Damo
The DataGridView.SelectedRows property contains a collection of all of the rows that the user has selected. You can spin through this collection and do what you wish with each row.
See this article for more information and example code.