Private Sub cbmes_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cbmes.MouseDown
If e.Button = MouseButtons.Right Then
cbmes.DroppedDown = True
End If
End Sub
sábado, 30 de septiembre de 2017
Desactivar botón derecho mouse ComboBox
Bloquear tecla Supr ComboBox
Private Sub cbmes_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cbmes.KeyDown
e.SuppressKeyPress = True
End Sub
e.SuppressKeyPress = True
End Sub
ComboBox no iniciar seleccionado
Seleccionar otro control...
TextBox.Select()
TextBox.Select()
Recorrer combobox
For i As Integer = 0 To comboBox.Items.Count - 1
MessageBox.Show(comboBox.Items.Add(i))
Next
MessageBox.Show(comboBox.Items.Add(i))
Next
jueves, 28 de septiembre de 2017
validar formato fecha
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fecha As String = tbfecha.Text.Trim
Dim formats() As String = {"d-MM-yyyy", "dd-MM-yyyy",
"dd-M-yyyy", "d-M-yyyy"} ' más de un formato
Dim format As String = "dd-MM-yyyy"
Dim thisDT As DateTime = Nothing
If DateTime.TryParseExact(fecha, format, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, thisDT) Then
MessageBox.Show("ok!")
Else
MessageBox.Show("no!")
End If
End Sub
fuente: https://stackoverflow.com/questions/24841806/validate-the-date-format-in-vb-net
Dim fecha As String = tbfecha.Text.Trim
Dim formats() As String = {"d-MM-yyyy", "dd-MM-yyyy",
"dd-M-yyyy", "d-M-yyyy"} ' más de un formato
Dim format As String = "dd-MM-yyyy"
Dim thisDT As DateTime = Nothing
If DateTime.TryParseExact(fecha, format, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, thisDT) Then
MessageBox.Show("ok!")
Else
MessageBox.Show("no!")
End If
End Sub
fuente: https://stackoverflow.com/questions/24841806/validate-the-date-format-in-vb-net
martes, 26 de septiembre de 2017
cambiar font en TabControl
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TabControl1.DrawMode = TabDrawMode.OwnerDrawFixed
End Sub
Properties TabControl, SizeMode: Fixed
Properties ItemSize
Dim fnt As Font = New Font(TabControl1.Font.FontFamily, 10, FontStyle.Bold)
'Dim BoldFont As New Font(TabControl1.Font, FontStyle.Bold)
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, fnt, Brushes.Black, e.Bounds)
Fuente:
http://www.vbforums.com/showthread.php?355093-Setting-selected-tabpage-header-text-to-bold
http://www.vbforums.com/showthread.php?355093-Setting-selected-tabpage-header-text-to-bold
http://www.vbforums.com/showthread.php?683624-RESOLVED-Setting-the-font-to-the-title-of-a-tab-page
https://stackoverflow.com/questions/38942995/increase-width-and-height-of-headers-in-tabcontrol
Private Sub TabControl1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
Dim fnt As Font = New Font(TabControl1.Font.FontFamily, 11, FontStyle.Bold)
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, fnt, Brushes.Black, e.Bounds)
End Sub
https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol
TabControl1.DrawMode = TabDrawMode.OwnerDrawFixed
End Sub
Properties TabControl, SizeMode: Fixed
Properties ItemSize
Dim fnt As Font = New Font(TabControl1.Font.FontFamily, 10, FontStyle.Bold)
'Dim BoldFont As New Font(TabControl1.Font, FontStyle.Bold)
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, fnt, Brushes.Black, e.Bounds)
Fuente:
http://www.vbforums.com/showthread.php?355093-Setting-selected-tabpage-header-text-to-bold
http://www.vbforums.com/showthread.php?355093-Setting-selected-tabpage-header-text-to-bold
http://www.vbforums.com/showthread.php?683624-RESOLVED-Setting-the-font-to-the-title-of-a-tab-page
https://stackoverflow.com/questions/38942995/increase-width-and-height-of-headers-in-tabcontrol
Private Sub TabControl1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
Dim fnt As Font = New Font(TabControl1.Font.FontFamily, 11, FontStyle.Bold)
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, fnt, Brushes.Black, e.Bounds)
End Sub
https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol
viernes, 22 de septiembre de 2017
Restar días a una fecha
DECLARE @fechai VARCHAR(10) = '2017-08-01'
declare @f varchar(30) = dateadd (day,-8,convert (date,DATEADD(month, ((YEAR(CONVERT(DATE,@fechai)) - 1900) * 12) + MONTH(CONVERT(DATE,@fechai)), -1)))
print @f
declare @f varchar(30) = dateadd (day,-8,convert (date,DATEADD(month, ((YEAR(CONVERT(DATE,@fechai)) - 1900) * 12) + MONTH(CONVERT(DATE,@fechai)), -1)))
print @f
Obtener el último día del mes sql
DECLARE @fechai VARCHAR(10) = '2018-04-01'
declare @f varchar(30) = convert (date,DATEADD(month, ((YEAR(CONVERT(DATE,@fechai)) - 1900) * 12) + MONTH(CONVERT(DATE,@fechai)), -1))
print @f
declare @f varchar(30) = convert (date,DATEADD(month, ((YEAR(CONVERT(DATE,@fechai)) - 1900) * 12) + MONTH(CONVERT(DATE,@fechai)), -1))
print @f
Sumar días a una fecha formato "yyyy-MM-dd" en sql
Ejemplo 1
declare @fechai varchar(10) = '2017-09-21'
declare @fechaok varchar(20)
set @fechaok = convert (date ,DATEADD(DAY,8,substring (@fechai,9,2) + substring (@fechai,5,3) +'-'+ substring (@fechai,1,4)))
print @fechaok
Ejemplo 2
declare @fechai varchar(10) = '2017-09-21'
declare @fechaok varchar(20)
set @fechaok = convert (date ,DATEADD(DAY,8,CONVERT(date,@fechai)))
print @fechaok
declare @fechai varchar(10) = '2017-09-21'
declare @fechaok varchar(20)
set @fechaok = convert (date ,DATEADD(DAY,8,substring (@fechai,9,2) + substring (@fechai,5,3) +'-'+ substring (@fechai,1,4)))
print @fechaok
Ejemplo 2
declare @fechai varchar(10) = '2017-09-21'
declare @fechaok varchar(20)
set @fechaok = convert (date ,DATEADD(DAY,8,CONVERT(date,@fechai)))
print @fechaok
Sumar dígitos de una fecha, formato string
Dim fechafin As String = "2017-05-12"
Dim sum As Integer = fechafin.Split("-").Select(Function(n) Int32.Parse(n)).Sum()
Dim sum As Integer = fechafin.Split("-").Select(Function(n) Int32.Parse(n)).Sum()
jueves, 21 de septiembre de 2017
query opcional
declare @q varchar(100)
SET @q = '33'
execute('select * from hist_DTE where tipo_DTE=' +@q+ '')
SET @q = '33'
execute('select * from hist_DTE where tipo_DTE=' +@q+ '')
jueves, 14 de septiembre de 2017
Deshabilitar selección azul Datagridview
dgvdte.DefaultCellStyle.SelectionBackColor = Color.White
dgvdte.DefaultCellStyle.SelectionForeColor = Color.Black
dgvdte.DefaultCellStyle.SelectionForeColor = Color.Black
Etiquetas:
DataGridView,
DefaultCellStyle,
SelectionBackColor
lunes, 4 de septiembre de 2017
Guía de despacho con valores exentos
https://goo.gl/P9sHJ2
indicador de traslado 1 y 5
indicador de traslado 1 y 5
viernes, 1 de septiembre de 2017
cambiar tipos de datos en sql
SELECT CAST(YourVarcharCol AS INT) FROM Table , recomendado usar CAST
SELECT CONVERT(INT, YourVarcharCol) FROM Table , recomendado para fechas y otros
SELECT CONVERT(INT, YourVarcharCol) FROM Table , recomendado para fechas y otros
Suscribirse a:
Entradas (Atom)