.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

DataGridView ComboBox visual style differs for same app on different systems

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :Windows Application
 

Issue:

In a windows forms application developed with VB2008 Express the DataGridView ComboBox is rendered differently on different systems. 

Details:

On Windows XP Pro SP3, where the app was developed, the combo box appears as follows:

Well, apparently images can't be pasted to these threads so I'll have to try to describe the appearance.

Appearance in Windows XP:

Rectangular box with the same shape, color and appearance as a DataGridView TextBox except that it has a square drop-down button at it's right edge the same color as a ToolStrip or ScrollBar buttons/elevator.

Appearance in Windows 7:

Rounded rectangular gray box, lighter on the top half to make it appear bowed out along it's horizontal axis with a rectangular drop-down button, also gray.  This appearance is displeasing alongside the flat, rectangular, white background text and image boxes in the same DataGridView.

Additional information:

Salient DataGridView properties:
AutoSizeColumnsMode: None
AutoSizeRowsMode: None
BorderStyle: FixedSingle
CellBorderStyle: Single


View Complete Post


More Related Resource Links

ActiveX and Visual Basic: Enhance the Display of Long Text Strings in a Combobox or Listbox

  

The combobox and listbox controls in Visual Basic have no built-in support for displaying text strings that are too long to fit in the visible area of either control. This article describes several techniques to improve the readability of long strings in each control. The first technique uses tooltips to display a combobox or listbox item. The other techniques, which use various Windows APIs, include adding a horizontal scrollbar for a listbox and determining the necessary width of the longest string given the font attributes of the text. The required steps are described for both comboboxes and listboxes.

John Calvert

MSDN Magazine December 2000


Virtual Source Code Control Systems: Promoting and Managing Projects using Visual SourceSafe

  

Source code control systems like Microsoft Visual SourceSafe can simplify just about any development project, and make it easier for your code to move safely among individual programmers, development teams, and project stages. Visual SourceSafe provides an object model that you can use as the basis of your own customized source code control environment. To give you an idea of what is possible, we'll walk you through the elements of a browser-based source code control system built with Visual SourceSafe, ASP, and VBScript. This simple system lets members of your team build, label, and promote individual files or entire projects, and to reverse promotions.

Ken Ramirez

MSDN Magazine May 2000


Combobox in DataGridView

  
Hi, How do I setup a selected value for a combobox column in datagridview? Unlike a regular combobox I can't use: SelectedValue = 1; I'll give an example :Let's say I have a datagrid which is consisted of two datasets tables: one table which contains 300 entries for different types of cars, and a combobox column which contains a list of 10 car makers (that's the second table). The car maker's code is the primary key in the combobox column's value member and the foreign key in the first table. How do I load the datagrid so that t the combobox will display the correct car maker for every car entry (300 in total)? here's my current code: private void SetupDataGridView() { this.Controls.Add(carsGrid); DataGridViewComboBoxColumn comboGrid = new DataGridViewComboBoxColumn(); carsGrid.DataSource = dsCars.Tables[1]; carsGrid.DisplayMember = "CarMakerName"; carsGrid.ValueMember = "CarMakerID"; carsGrid.DataSource = dsCars.Tables[0]; carsGrid.Columns.Add(comboGrid); } Thanks, Udi

Different ComboBox in Each Row of DataGridView

  
Hi,   Can I have a ComboBoxColumn in a DataGridView with different items in the ComboBox of each row?   For instance, suppose there's a DataGridView in a Windows Form with rows of customer info. There's a column that shows the gender and a ComboBoxColumn to set the title. If the customer is male, the ComboBox will contain "Mr", "Dr" etc, otherwise it will have "Miss", "Mrs" etc.   How can this be done?   I saw this post but can't quite understand what it means. http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3311173&SiteID=1     Thanks, ywb

problem in make editable a combobox in datagridview in c#

  
how do i make my datagridview combobox aditable for the user while i has a drop down list. in this case sometimes user needs to edit the selected item from the list.how can i implement this?

Base Style with named visual elements

  

Hy everybody,I am struggling with a problem. I want to create a base look for my application buttons. This is the base style that I want to apply:

 

    <Style TargetType="{x:Type common:NumericIncDec}">
      <Setter Property="Control.Template">
        <Setter.Value>
          <ControlTemplate>
            <Border Width="115

No combobox ajax control visible in Visual Studio 2008 web project

  

Greetings -

New user to Visual Studio 2008 - one of the reasons for upgrading from 2005 was because I wanted to use the AJAX Toolbox Control for combobox in my web forms. 

Have started a new project, have told it to use .net 3.5 for the project, but when I go to the ajax tooklkit in the toolbox panel there is no combobox.  Could someone please tell me why it isn't there?

Environment - Visual Studio 2008 SP1

Many thanks - OfficeWonk

 


WPF ComboBox Style/Template example from MSDN doesnt work if "IsEnabled"=false?

  

Hello!

I am using a customized look of the WPF combobox control with the help of the msdn Style and Combox Template example taken from here: http://msdn.microsoft.com/en-us/library/ms752094.aspx

I copied that code and I can use the control just fine, but as soon as you set the combobox attribute "IsEnabled" to false, you always get an error warning in Visual Studio 2010 Designer view with the following message:

'System.Windows.Media.Animation.ColorAnimationUsingKeyFrames' animation object cannot be used to animate property 'Foreground' because it is of incompatible type 'System.Windows.Media.Brush'.

Actually I have no idea on how to fix this error. Does anyone have an idea what is causing this error? Since its an msdn example everyone should encounter this error when disabling the control with this template example?

Thanks in advance for your help, kind regards,
Oliver


Datagridview combobox.DroppedDown issues that require (2) clicks and not (1)

  

I have been reviewing following link regarding datagridview.combobox.droppeddown...the last entry is apparently not VB.NET.  Else I am missing something.

http://social.msdn.microsoft.com/forums/en-us/winforms/thread/441E8E09-6D20-430A-B31E-13ECD277BA78

The last entry supposedly will work, however I can't come close.

Also, to expand on the issue I have is that I am attempting to click on a combobox cell at any time...whether it's the currently selected row or a different row in the gridview.  If it is a different row, that is really where I experience the problem.  I've attempted to use the following:

 

Private Sub dataGridView1_EditingControlShowing(ByVal sender As Object, _

 

ByVal e As DataGridViewEditingControlShowingEventArgs) _

 

WPF ComboBox Style/Template example from MSDN "IsEnabled"=false gives designer warning/error in VS20

  

Hello!

I am using a customized look of the WPF combobox control with the help of the msdn Style and Combox Template example taken from here: http://msdn.microsoft.com/en-us/library/ms752094.aspx

I copied that code and I can use the control just fine, but as soon as you set the combobox attribute "IsEnabled" (within the xaml) to false, you always get an error/warning in Visual Studio 2010 Designer view with the following message:

'System.Windows.Media.Animation.ColorAnimationUsingKeyFrames' animation object cannot be used to animate property 'Foreground' because it is of incompatible type 'System.Windows.Media.Brush'.

Actually I have no idea on how to fix this error - though I can run and compile the code fine. Does anyone have an idea what is causing this error? Since its an msdn example everyone should encounter this error when disabling the control with this template example?

Thanks in advance for your help, kind regards,
Oliver


Setting a focus on a datagridview - visual basic 2010

  

i am was able to cause the mouse wheel to work on my datagridview.

now i have noticed that when the form first loads i actually need to click the datagridview to set the focus on it and then i can scroll

i added two line for my form load event

    ' Selecting first datagrid row
        grdAccountTypes.Rows(0).Selected = True
        grdAccountTypes.Focus()

but that didn't solve my problem either.

 

any ideas ?

 


How can I fill a Combobox in a datagridview? C#

  

I have made by code a datagridview. This datagridview has several comboboxes.

I want to populate this comboboxes at runtime. But I don't know how.

The code I tried:

NaardataGridView2.CurrentCell.Value = getKolommen(selVanTabellen);

 

getKolommen give a datatable with names. The above code doesn't work. I want something like:

NaardataGridView2.CurrentCell.DataSource = getKolommen(selVanTabellen);

 

Can some one help me?

 


Datagridview combobox

  

I have a bound datagridview with a combobox that is populated from another datasource.  I am trying to bind a label to the same datasource that is used in the combobox.  When the combobox selection is  changed I need the label to change with the corresponing row in the datasource.

Here is the code:

 

 

Me.CostItemsTableAdapter.FillByProjectId(Me.BuildersJobCostDatabaseDataSet.CostItems, publicCurrentProjectId)

combobox in a datagridview error

  

I used t his link for comboboxin a winforms datagridview.

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/1f18cc35-00fa-406e-8f9c-97ce0a4a4e19/

 

In the designer, click on the arrow (gridview tasks) on the gridview.
I set the datasource of the grid to the appropriate dataset.
Then, click on edit columns. On this, changed one one column Type to datagridviewcomboboxcolumn.

DataPropertyName= "Vehicle"
DataSource = "VehicleDataset" - This is a different dataset which has 2 columns (ID and Name)
DisplayMember = "VehicleName"
Items=
ValueMember = "VehicleID"

This combox get teh data from a table called vehicles which has id and name. i populate them in vehicledataset.

When i load the form, i am getting a error.
I trapped the error in a datagridview_dataerror event
e.message  - Argument exception - datagrieviewcomboboxcell value is not valid.

Why i am gettign this error if i am using the value member?

Thanks


ComboBox style not used by DataGridComboBoxColumn?

  
I created a style for ComboBox.  It works for a standalone ComboBox.  However, the combo box column is not using it.  Is there a way to do this?

Visual Case Tool - UML Tutorial

  
The Class Diagram

The class diagram is core to object-oriented design. It describes the types of objects in the system and the static relationships between them.

ASP.NET repeater control - databind with style

  
even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend