Click here to Skip to main content
15,914,410 members
Home / Discussions / C#
   

C#

 
GeneralRe: Create a toolbar Pin
Robert Rohde30-May-05 5:06
Robert Rohde30-May-05 5:06 
GeneralRe: Create a toolbar Pin
Sasuko30-May-05 13:06
Sasuko30-May-05 13:06 
GeneralRe: Create a toolbar Pin
Robert Rohde30-May-05 18:48
Robert Rohde30-May-05 18:48 
Generalprint datagrid Pin
georgeser30-May-05 1:25
georgeser30-May-05 1:25 
QuestionIs this Really a Difficult Question??? Pin
innocent7330-May-05 0:47
innocent7330-May-05 0:47 
AnswerRe: Is this Really a Difficult Question??? Pin
Niklas Ulvinge30-May-05 2:40
Niklas Ulvinge30-May-05 2:40 
AnswerRe: Is this Really a Difficult Question??? Pin
Robert Rohde30-May-05 3:41
Robert Rohde30-May-05 3:41 
AnswerRe: Is this Really a Difficult Question??? Pin
rudy.net30-May-05 5:57
rudy.net30-May-05 5:57 
If you are using DataGridTextColumns then you have access to the TextBox that gets placed when user tries to edit values and since you have access to this TextBox then you can also place event handlers to handle keypresses and in your handler you can do anything you like.
I have the following code in VB but is same basic concept:
<br />
<br />
        ' Add column<br />
        textCol = New DataGridTextBoxColumn<br />
        textCol.MappingName = "Binary Value"<br />
        textCol.HeaderText = "BinValue"<br />
        textCol.Width = 160<br />
        ts1.GridColumnStyles.Add(textCol)<br />
        AddHandler textCol.TextBox.KeyPress, AddressOf grdBitfield_keypressHandler<br />
        textCol.TextBox.BackColor = Color.Yellow  'show edit box in yellow color<br />
<br />
<br />
    Private Sub grdBitfield_keypressHandler(ByVal sender As Object, ByVal e As KeyPressEventArgs)<br />
        'handle backspace and delete keys<br />
        If e.KeyChar = Convert.ToChar(Keys.Delete) Then Return<br />
        If e.KeyChar = Convert.ToChar(Keys.Back) Then Return<br />
<br />
        If grdBitfield.CurrentCell.ColumnNumber = 5 Then 'BinValue column<br />
            If Not (e.KeyChar = "0" Or e.KeyChar = "1") Then<br />
                e.Handled = True  'get out immeditely<br />
            End If<br />
        Else<br />
            e.Handled = True<br />
        End If<br />
<br />
    End Sub<br />

Hope that helps.
GeneralRe: Is this Really a Difficult Question??? Pin
innocent7330-May-05 21:00
innocent7330-May-05 21:00 
GeneralRe: Is this Really a Difficult Question??? Pin
rudy.net31-May-05 3:20
rudy.net31-May-05 3:20 
Generalcopying base class object to derived class object Pin
hasansheik29-May-05 23:47
hasansheik29-May-05 23:47 
GeneralRe: copying base class object to derived class object Pin
S. Senthil Kumar29-May-05 23:55
S. Senthil Kumar29-May-05 23:55 
GeneralRe: copying base class object to derived class object Pin
hasansheik30-May-05 0:04
hasansheik30-May-05 0:04 
GeneralRe: copying base class object to derived class object Pin
S. Senthil Kumar30-May-05 3:37
S. Senthil Kumar30-May-05 3:37 
GeneralWeb Service Exceptions at run time Pin
skrishnasarma29-May-05 22:43
skrishnasarma29-May-05 22:43 
GeneralCompatibilty problem with Excel 2000,Excel 2002 and Excel 2003 Pin
ksanju100029-May-05 20:05
ksanju100029-May-05 20:05 
Generalusb interfacing in C# Pin
ahsan14129-May-05 19:55
ahsan14129-May-05 19:55 
GeneralRe: usb interfacing in C# Pin
FriendlyFiend29-May-05 20:41
FriendlyFiend29-May-05 20:41 
GeneralRe: usb interfacing in C# Pin
eggie529-May-05 20:48
eggie529-May-05 20:48 
GeneralRun tlbimp programatically Pin
Member 1697729-May-05 19:16
Member 1697729-May-05 19:16 
GeneralCall Windows Dial up thr C# Pin
ksanju100029-May-05 19:10
ksanju100029-May-05 19:10 
GeneralAbout TreeNode Pin
Paul Sun29-May-05 16:24
Paul Sun29-May-05 16:24 
GeneralRe: About TreeNode Pin
Paul Sun29-May-05 16:31
Paul Sun29-May-05 16:31 
GeneralRe: About TreeNode Pin
mav.northwind29-May-05 21:30
mav.northwind29-May-05 21:30 
Generalquestion regarding &quot;SerializationInfo&quot; parameter in the serialization function Pin
Green Fuze29-May-05 15:49
Green Fuze29-May-05 15:49 

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.