Click here to Skip to main content
16,011,849 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VS 2008 Express - need to create a setup package Pin
Johan Hakkesteegt2-Oct-08 1:47
Johan Hakkesteegt2-Oct-08 1:47 
AnswerRe: VS 2008 Express - need to create a setup package Pin
jzonthemtn2-Oct-08 6:01
jzonthemtn2-Oct-08 6:01 
GeneralRe: VS 2008 Express - need to create a setup package Pin
Paul Conrad2-Oct-08 9:35
professionalPaul Conrad2-Oct-08 9:35 
GeneralRe: VS 2008 Express - need to create a setup package Pin
Anoop Brijmohun2-Oct-08 20:27
Anoop Brijmohun2-Oct-08 20:27 
QuestionWinForms DatagridView Field Pin
MatthysDT1-Oct-08 23:12
MatthysDT1-Oct-08 23:12 
AnswerRe: WinForms DatagridView Field Pin
George B Gilbert2-Oct-08 6:40
George B Gilbert2-Oct-08 6:40 
GeneralRe: WinForms DatagridView Field Pin
MatthysDT2-Oct-08 20:07
MatthysDT2-Oct-08 20:07 
GeneralRe: WinForms DatagridView Field Pin
George B Gilbert3-Oct-08 9:48
George B Gilbert3-Oct-08 9:48 
I love a worthwhile challenge. It's taken all morning, but, I think I've got it. The key is overriding the ProcessCmdKey method in the DataGridView class so that the Enter key can be detected and Ctrl^Enter substituted.

Step 1 is to add an extended DataGridView to your project where the override takes place.

Public Class myDataGridView
    Inherits DataGridView

    Protected Overrides Function ProcessCmdKey( _
              ByRef msg As System.Windows.Forms.Message, _
              ByVal keyData As System.Windows.Forms.Keys) _
              As Boolean

        '** When the Enter key is pressed in the textbox column,
        '** substitute Ctrl^Enter
        If keyData = Keys.Enter Then
            SendKeys.SendWait("^{ENTER}")
            Return True
        Else
            Return MyBase.ProcessDialogKey(keyData)
        End If

    End Function

End Class


Unfortunately, this means the DataGridView control will have to be completely built and positioned on the form at runtime to take advantage of the override. Here's the simple code I used for testing. You will have to flesh it out for your purposes.

Public Class Form1

    Dim dgv As New myDataGridView

    Private Sub Form1_Load(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) _
                           Handles MyBase.Load

        '** Add the datagridview to the form
        Controls.Add(dgv)
        dgv.Left = 10
        dgv.Top = 10

        '** Add a textbox column
        Dim dgvCol As New DataGridViewTextBoxColumn
        With dgvCol
            .HeaderText = "Text Column"
            .Name = "chdrTextCol"
            .Width = 130
        End With
        dgv.Columns.Add(dgvCol)
        dgvCol = Nothing

        '** Add a row
        dgv.Rows.Add()

    End Sub

End Class

GeneralRe: WinForms DatagridView Field Pin
MatthysDT6-Oct-08 2:13
MatthysDT6-Oct-08 2:13 
GeneralRe: WinForms DatagridView Field Pin
George B Gilbert6-Oct-08 5:42
George B Gilbert6-Oct-08 5:42 
QuestionExport DataGrid to Excel Pin
jalpam1-Oct-08 20:11
jalpam1-Oct-08 20:11 
AnswerRe: Export DataGrid to Excel Pin
Ashfield1-Oct-08 21:17
Ashfield1-Oct-08 21:17 
AnswerRe: Export DataGrid to Excel Pin
Johan Hakkesteegt1-Oct-08 23:44
Johan Hakkesteegt1-Oct-08 23:44 
GeneralRe: Export DataGrid to Excel Pin
jalpam3-Oct-08 1:21
jalpam3-Oct-08 1:21 
QuestionNeed Help with the DirectoryServices namespace in .net 3.5 Pin
timraines1-Oct-08 19:27
timraines1-Oct-08 19:27 
AnswerRe: Need Help with the DirectoryServices namespace in .net 3.5 Pin
timraines2-Oct-08 3:22
timraines2-Oct-08 3:22 
AnswerRe: Need Help with the DirectoryServices namespace in .net 3.5 [modified] Pin
richardw482-Oct-08 3:54
richardw482-Oct-08 3:54 
GeneralRe: Need Help with the DirectoryServices namespace in .net 3.5 Pin
timraines2-Oct-08 18:03
timraines2-Oct-08 18:03 
GeneralRe: Need Help with the DirectoryServices namespace in .net 3.5 Pin
timraines2-Oct-08 20:07
timraines2-Oct-08 20:07 
QuestionRevert to last successful build? Pin
craigmg781-Oct-08 6:49
craigmg781-Oct-08 6:49 
AnswerRe: Revert to last successful build? Pin
jzonthemtn1-Oct-08 9:24
jzonthemtn1-Oct-08 9:24 
AnswerRe: Revert to last successful build? Pin
Paul Conrad1-Oct-08 10:02
professionalPaul Conrad1-Oct-08 10:02 
QuestionVB code for sending an email through .net application using smtp Pin
lostboy2411-Oct-08 4:09
lostboy2411-Oct-08 4:09 
AnswerRe: VB code for sending an email through .net application using smtp Pin
Tom Deketelaere1-Oct-08 5:13
professionalTom Deketelaere1-Oct-08 5:13 
GeneralRe: VB code for sending an email through .net application using smtp Pin
lostboy2411-Oct-08 7:46
lostboy2411-Oct-08 7:46 

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.