miércoles, 26 de septiembre de 2012

Agregar Numero de Fila en RowHeader del DatagridView

Agregar Numero de Fila en RowHeader del DatagridView


Super bien y funciona. Origen

Private Sub MiGrid_RowPostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles MiGrid.RowPostPaint

 Dim grid As DataGridView = DirectCast(sender, DataGridView)
        Dim strRowNumber As String = (e.RowIndex + 1).ToString
        While strRowNumber.Length < grid.RowCount.ToString.Length
            strRowNumber = "0" & strRowNumber
        End While
        Dim size As SizeF = e.Graphics.MeasureString(strRowNumber, Me.Font)
        If grid.RowHeadersWidth < CInt(size.Width + 20) Then
            grid.RowHeadersWidth = CInt(size.Width + 20)
        End If
        Dim bt As Brush = SystemBrushes.ControlText
        e.Graphics.DrawString(strRowNumber, Me.Font, bt, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2))

    End Sub

martes, 25 de septiembre de 2012

Buscar dentro de archivos

Cuando teniamos el XP, para buscar un texto dentro de los archivos, habia una opcion bien visible. El vista y 7, aun está pero no esta a la vista. La solución:

http://geeks.ms/blogs/vista-tecnica/archive/2007/04/30/b-250-squedas-en-windows-vista-i-de-iv-por-alex-refojo.aspx

martes, 11 de septiembre de 2012

Se ha superado el número máximo de advertencias.

He heredado un código que en la ventana de errores sale el mensaje “Se ha superado el número máximo de advertencias.” ( aun me sorprende lo poco se preocupa la gente por tener un código sin advertencias de compilación)
 Casi todos las advertencias son por :
Advertencia    El tipo de parámetro ‘xxx’ no es conforme a CLS.
Hay una forma de evitar estas advertencias al compilar sin tocar nada de código  y consiste en poner en el Assembly. Info 


<Assembly: CLSCompliant(FALSE)>