TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
[email protected]
NA
1
0
I have problem to get value in a grid from comboboxlist that is added togrid cell already
May 24 2005 3:25 AM
Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents dgdFunctionArea As System.Windows.Forms.DataGrid Friend WithEvents cmbFunctionArea As System.Windows.Forms.ComboBox Friend WithEvents DataGridTableStyle1 As System.Windows.Forms.DataGridTableStyle Friend WithEvents DataGridTextBoxColumn1 As System.Windows.Forms.DataGridTextBoxColumn Friend WithEvents DataGridTextBoxColumn2 As System.Windows.Forms.DataGridTextBoxColumn Friend WithEvents DataGridTextBoxColumn3 As System.Windows.Forms.DataGridTextBoxColumn Friend WithEvents DataGridTextBoxColumn4 As System.Windows.Forms.DataGridTextBoxColumn
Private Sub InitializeComponent() Me.dgdFunctionArea = New System.Windows.Forms.DataGrid Me.DataGridTableStyle1 = New System.Windows.Forms.DataGridTableStyle Me.DataGridTextBoxColumn1 = New System.Windows.Forms.DataGridTextBoxColumn Me.DataGridTextBoxColumn2 = New System.Windows.Forms.DataGridTextBoxColumn Me.DataGridTextBoxColumn3 = New System.Windows.Forms.DataGridTextBoxColumn Me.DataGridTextBoxColumn4 = New System.Windows.Forms.DataGridTextBoxColumn Me.cmbFunctionArea = New System.Windows.Forms.ComboBox CType(Me.dgdFunctionArea, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'dgdFunctionArea ' Me.dgdFunctionArea.DataMember = "" Me.dgdFunctionArea.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.dgdFunctionArea.Location = New System.Drawing.Point(0, 0) Me.dgdFunctionArea.Name = "dgdFunctionArea" Me.dgdFunctionArea.Size = New System.Drawing.Size(584, 224) Me.dgdFunctionArea.TabIndex = 0 Me.dgdFunctionArea.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle() {Me.DataGridTableStyle1}) ' 'DataGridTableStyle1 ' Me.DataGridTableStyle1.DataGrid = Me.dgdFunctionArea Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGridTableStyle1.MappingName = "" ' 'DataGridTextBoxColumn1 ' Me.DataGridTextBoxColumn1.Format = "" Me.DataGridTextBoxColumn1.FormatInfo = Nothing Me.DataGridTextBoxColumn1.MappingName = "" Me.DataGridTextBoxColumn1.Width = 120 ' 'DataGridTextBoxColumn2 ' Me.DataGridTextBoxColumn2.Format = "" Me.DataGridTextBoxColumn2.FormatInfo = Nothing Me.DataGridTextBoxColumn2.MappingName = "" Me.DataGridTextBoxColumn2.Width = 50 ' 'DataGridTextBoxColumn3 ' Me.DataGridTextBoxColumn3.Format = "" Me.DataGridTextBoxColumn3.FormatInfo = Nothing Me.DataGridTextBoxColumn3.MappingName = "" Me.DataGridTextBoxColumn3.Width = 50 ' 'DataGridTextBoxColumn4 ' Me.DataGridTextBoxColumn4.Format = "" Me.DataGridTextBoxColumn4.FormatInfo = Nothing Me.DataGridTextBoxColumn4.MappingName = "" Me.DataGridTextBoxColumn4.Width = 80 ' 'cmbFunctionArea ' Me.cmbFunctionArea.Dock = System.Windows.Forms.DockStyle.Fill Me.cmbFunctionArea.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.cmbFunctionArea.Items.AddRange(New Object() {"gfhgsdasdasd", "kmhjkhasdasd", "kjlkjsadasdasdasdaasdasd"}) Me.cmbFunctionArea.Location = New System.Drawing.Point(0, 0) Me.cmbFunctionArea.Name = "cmbFunctionArea" Me.cmbFunctionArea.Size = New System.Drawing.Size(584, 21) Me.cmbFunctionArea.TabIndex = 1 ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(584, 446) Me.Controls.Add(Me.cmbFunctionArea) Me.Controls.Add(Me.dgdFunctionArea) Me.Name = "Form1" Me.Text = "Form1" CType(Me.dgdFunctionArea, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private dtblfunctionalarea As DataTable Private Sub PopulateGrid() Dim dtcol As DataColumn = Nothing Dim arrstrFunctionalArea As String() = Nothing arrstrFunctionalArea = New String(3) {} arrstrFunctionalArea(0) = "Functional Area" arrstrFunctionalArea(1) = "Min" arrstrFunctionalArea(2) = "Max" dtblfunctionalarea = New DataTable("FunctionalArea") Dim i As Integer For i = 0 To 2 Dim str As String = arrstrFunctionalArea(i) dtcol = New DataColumn(str) dtcol.DataType = System.Type.GetType("System.String") dtcol.DefaultValue = "" dtblfunctionalarea.Columns.Add(dtcol) Next i Dim dtcCheck As New DataColumn("IsMandatory") dtcCheck.DataType = System.Type.GetType("System.Boolean") dtcCheck.DefaultValue = "false" dtblfunctionalarea.Columns.Add(dtcCheck) dgdFunctionArea.DataSource = dtblfunctionalarea '''''''''''''''''''''' Me.DataGridTableStyle1.MappingName = dtblfunctionalarea.TableName Me.DataGridTableStyle1.AllowSorting = False Me.DataGridTableStyle1.DataGrid = Me.dgdFunctionArea Me.DataGridTableStyle1.GridColumnStyles.AddRange(New System.Windows.Forms.DataGridColumnStyle() {Me.DataGridTextBoxColumn1, Me.DataGridTextBoxColumn2, Me.DataGridTextBoxColumn3, Me.DataGridTextBoxColumn4}) Me.DataGridTableStyle1.HeaderBackColor = System.Drawing.SystemColors.ActiveCaptionText Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGridTableStyle1.PreferredRowHeight = 22 Me.DataGridTableStyle1.RowHeadersVisible = False '''''''''''''''''''''''''' Dim dgtb As DataGridTextBoxColumn = CType(dgdFunctionArea.TableStyles(0).GridColumnStyles(0), DataGridTextBoxColumn) dgtb.ReadOnly = True dgtb.TextBox.Controls.Add(cmbFunctionArea) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load PopulateGrid() End Sub Private Sub cmbFunctionArea_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbFunctionArea.SelectedIndexChanged End Sub End Class
Reply
Answers (
0
)
Help need with trianing paths in C##.net ...please!
How can I change color on Items in a listBox at runtime?