Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
QuestionCall functions of window service from web service Pin
skysunil14-Sep-06 21:24
skysunil14-Sep-06 21:24 
QuestionToolbar question Pin
saqib8214-Sep-06 21:00
saqib8214-Sep-06 21:00 
AnswerRe: Toolbar question Pin
Stefan Troschuetz14-Sep-06 21:21
Stefan Troschuetz14-Sep-06 21:21 
GeneralRe: Toolbar question Pin
saqib8214-Sep-06 23:24
saqib8214-Sep-06 23:24 
GeneralRe: Toolbar question Pin
Stefan Troschuetz14-Sep-06 23:39
Stefan Troschuetz14-Sep-06 23:39 
QuestionTreeView and DataGrid Problem Pin
wasife14-Sep-06 20:50
wasife14-Sep-06 20:50 
QuestionCreate Combobox in Datagrid Pin
vaishali1014-Sep-06 20:44
vaishali1014-Sep-06 20:44 
AnswerRe: Create Combobox in Datagrid Pin
Amit Kushwaha14-Sep-06 21:11
Amit Kushwaha14-Sep-06 21:11 
Hi,

Regarding ur prob here is the solution...
============================================

Public Class Form1
Inherits System.Windows.Forms.Form

'Declare objects required to connect to the database
Private mcnSQL As New SqlClient.SqlConnection("SERVER=(local); INTEGRATED SECURITY=SSPI; DATABASE=northwind")
Private mdaEmploye As New SqlClient.SqlDataAdapter("SELECT TitleOfCourtesy, FirstName, LastName, Title FROM Employees", mcnSQL)
Private mds As New DataSet()

'We will also need a combo - After all, this is what we want to do!
Private mctlCombo As New ComboBox()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Connect the TextChanged event to a procedure
AddHandler mctlCombo.TextChanged, AddressOf Ctrls_TextChanged

'Fill ComboBox list.
With mctlCombo
.Name = "MyCombo"
.Visible = False
.Items.Clear()
.Items.Add("Sales Representative")
.Items.Add("Inside Sales Coordinator")
.Items.Add("Vice President, Sales")
.Items.Add("Sales Manager")
.Items.Add("Flunky")
End With

'Fill the dataset
mdaEmploye.Fill(mds, "Employees")

'Set the RowHeight of the DataGrid to the height of the ComboBox.
DataGrid1.PreferredRowHeight = mctlCombo.Height

'Give the data to the DataGrid
DataGrid1.DataSource = mds
DataGrid1.DataMember = "Employees"

'Add ComboBox to the Control collection of the DataGrid.
DataGrid1.Controls.Add(mctlCombo)
End Sub

Private Sub DataGrid1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles DataGrid1.Paint
'Set the width of the ComboBox to the Width of the cell
If DataGrid1.CurrentCell.ColumnNumber = 3 Then
mctlCombo.Width = DataGrid1.GetCurrentCellBounds.Width
End If
End Sub

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
'Display (or hide) the ComboBox
If DataGrid1.CurrentCell.ColumnNumber = 3 Then
With mctlCombo
.Visible = False
.Width = 0
.Left = DataGrid1.GetCurrentCellBounds.Left
.Top = DataGrid1.GetCurrentCellBounds.Top
.Text = DataGrid1.Item(DataGrid1.CurrentCell).ToString & ""
.Visible = True
End With
Else
HideComboBox(sender, e)
End If
End Sub

Private Sub HideComboBox(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Scroll, DataGrid1.Click
'Hide the ComboBox when the grid is clicked or scrolled
mctlCombo.Visible = False
mctlCombo.Width = 0
End Sub

Private Sub Ctrls_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
'When the an item is selected, the grid must show this new value
If DataGrid1.CurrentCell.ColumnNumber = 3 Then
mctlCombo.Visible = False
If DataGrid1.Item(DataGrid1.CurrentCell).ToString & "" = "" Then SendKeys.Send("*")
DataGrid1.Item(DataGrid1.CurrentCell) = mctlCombo.Text
End If
End Sub

End Class

GeneralRe: Create Combobox in Datagrid Pin
vaishali1014-Sep-06 21:31
vaishali1014-Sep-06 21:31 
AnswerRe: Create Combobox in Datagrid Pin
Hamid_RT15-Sep-06 6:53
Hamid_RT15-Sep-06 6:53 
QuestionC# file upload progress bar Pin
Arindam Tewary14-Sep-06 20:22
professionalArindam Tewary14-Sep-06 20:22 
QuestionDotNet Crystal Report Pin
peshawarcoder14-Sep-06 20:01
peshawarcoder14-Sep-06 20:01 
QuestionHow to conver byt buffer to char array Pin
Parshant Verma14-Sep-06 19:46
Parshant Verma14-Sep-06 19:46 
AnswerRe: How to conver byt buffer to char array Pin
stancrm14-Sep-06 20:53
stancrm14-Sep-06 20:53 
AnswerRe: How to conver byt buffer to char array Pin
wasife15-Sep-06 0:22
wasife15-Sep-06 0:22 
AnswerRe: How to conver byt buffer to char array Pin
Hamid_RT15-Sep-06 6:42
Hamid_RT15-Sep-06 6:42 
Questionview state Pin
govind kanidapu14-Sep-06 19:02
govind kanidapu14-Sep-06 19:02 
AnswerRe: view state Pin
Christian Graus14-Sep-06 19:19
protectorChristian Graus14-Sep-06 19:19 
QuestionDll Import Problem in loading two c++ assemblies with same name Pin
He is Cool14-Sep-06 18:50
He is Cool14-Sep-06 18:50 
GeneralRe: Dll Import Problem in loading two c++ assemblies with same name Pin
Guffa14-Sep-06 19:15
Guffa14-Sep-06 19:15 
GeneralRe: Dll Import Problem in loading two c++ assemblies with same name Pin
He is Cool14-Sep-06 19:50
He is Cool14-Sep-06 19:50 
QuestionWin32 Functions InteropServices problems Pin
erikkl200014-Sep-06 17:28
erikkl200014-Sep-06 17:28 
Questionlooking for tab control like office 2003 shared workspace's style? Pin
jacktom14-Sep-06 17:09
jacktom14-Sep-06 17:09 
QuestionHow to develop an ie extension similar as google notebook? Pin
rryyjw14-Sep-06 16:09
rryyjw14-Sep-06 16:09 
QuestionHow to grab a web page using .Net 2.0 WebBrowser Control Pin
rryyjw14-Sep-06 16:06
rryyjw14-Sep-06 16:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.