Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-08-2006, 11:30 AM   PM User | #1
handshakeit
New Coder

 
Join Date: Oct 2005
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
handshakeit is an unknown quantity at this point
convert this code in C#

Hi all

Can Any one convert this in C#
I hav problem in CBool function what it does

Code:
Private afterCurrentCellChanged As Boolean = False
Private Sub dataGrid1_Click(ByVal sender As System.Object, _
       ByVal e As System.EventArgs) Handles DataGrid1.Click
   Dim discontinuedColumn As Integer = 0
   Dim pt As Point = Me.dataGrid1.PointToClient( _
       Control.MousePosition)
   Dim hti As DataGrid.HitTestInfo = _
       Me.dataGrid1.HitTest(pt)
   Dim bmb As BindingManagerBase = _
       Me.BindingContext(Me.dataGrid1.DataSource, _
       Me.dataGrid1.DataMember)

   If afterCurrentCellChanged _
      AndAlso hti.Row < bmb.Count _
      AndAlso hti.Type = DataGrid.HitTestType.Cell _
      AndAlso hti.Column = discontinuedColumn Then
        Me.DataGrid1(hti.Row, discontinuedColumn) = _
           Not CBool(Me.DataGrid1(hti.Row, _
                 discontinuedColumn))
    End If
    afterCurrentCellChanged = False
End Sub 'dataGrid1_Click

    'add a line to this existing handler
Private Sub dataGrid1_CurrentCellChanged( _
            ByVal sender As System.Object, _
            ByVal e As System.EventArgs) _
        Handles DataGrid1.CurrentCellChanged
    'if click on a discontinued row, then set 
    'currentcell to checkbox
    Dim discontinuedColumn As Integer = 0
    Dim val As Object = Me.DataGrid1( _
         Me.DataGrid1.CurrentRowIndex, _
         discontinuedColumn)
    Dim productDiscontinued As Boolean = CBool(val)
    If productDiscontinued Then
         Me.DataGrid1.CurrentCell = _
           New DataGridCell( Me.DataGrid1.CurrentRowIndex, _
                             discontinuedColumn)
    End If
    'add this line
    afterCurrentCellChanged = True 
End Sub 'dataGrid1_CurrentCellChanged
handshakeit is offline   Reply With Quote
Old 02-14-2007, 08:10 AM   PM User | #2
s4sadia
New to the CF scene

 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
s4sadia is an unknown quantity at this point
Code In C#

Code:
private void dg_AL_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
//dg_Al is DataGrid1//////////////////////
DataGrid g  = dg_AL;
DataGrid.HitTestInfo hti = g.HitTest(new Point(e.X, e.Y));
BindingManagerBase bmb = BindingContext[g.DataSource, g.DataMember];
if((hti.Row < bmb.Count) && (hti.Type == DataGrid.HitTestType.Cell) && hti.Row !=hitRow)
{ 
if(!(toolTip1 == null) && toolTip1.Active)
{
toolTip1.Active = false;
}
string tipText = "";
if (Convert.ToBoolean(dg_AL[hti.Row, 0]))
{
tipText = dg_AL[hti.Row, 1].ToString()+" discontinued";
if(tipText != "")
{
//	new hit row
hitRow = hti.Row;
toolTip1.SetToolTip(dg_AL, tipText);
// make it active so it can show
toolTip1.Active = true ;
}
else
{ hitRow = -1;}
}
else
hitRow = -1;
}
}
s4sadia is offline   Reply With Quote
Old 02-14-2007, 08:33 AM   PM User | #3
s4sadia
New to the CF scene

 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
s4sadia is an unknown quantity at this point
cbool is for boolean colum in datagrid which is mapped by bool column of product table from northwind database .complete list of coding is available at

http://msdn2.microsoft.com/en-us/library/ms996485.aspx

and CBool is function that is chking for 0 and 1 value and converting it n true and false
s4sadia is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 PM.


Advertisement
Log in to turn off these ads.