GeoAvila (Geovanny G. Avila) Desarrollo.. de software.

6Aug/090

Valida TextBox si es Entero o Decimal

Bueno estas funciones ayudan a validar si el texto ingresado en un textbox es un valor numérico ó es un valor decimal, estas son de las validaciones más usadas para desarrollar así que acá se los dejo.

VB.NET:
  1. Public Shared Function EsInteger(ByVal theValue As String) As Boolean
  2.     'funcion para enteros
  3.     Try
  4.         Convert.ToInt32(theValue)
  5.         Return True
  6.     Catch
  7.         Return False
  8.     End Try
  9. End Function
  10.  
  11. Public Shared Function EsDecimal(ByVal theValue As String) As Boolean
  12.     'funcion para enteros
  13.     Try
  14.         Convert.ToDecimal(theValue)
  15.         Return True
  16.     Catch
  17.         Return False
  18.     End Try
  19. End Function

C#:
  1. public static bool EsInteger(string theValue)//funcion para enteros
  2.         {
  3.             try
  4.             {
  5.                 Convert.ToInt32(theValue);
  6.                 return true;
  7.             }
  8.             catch
  9.             {
  10.                 return false;
  11.             }
  12.         }
  13.  
  14.         public static bool EsDecimal(string theValue)//funcion para enteros
  15.         {
  16.             try
  17.             {
  18.                 Convert.ToDecimal(theValue);
  19.                 return true;
  20.             }
  21.             catch
  22.             {
  23.                 return false;
  24.             }
  25.         }

otra manera de validar de parte de @cmsalvado gracias por el dato:

VB.NET:
  1. Public Shared Function EsInteger(ByVal theValue As String) As Boolean
  2. Dim value As Integer
  3. Return Integer.TryParse(theValue, value)
  4. End Function

C#:
  1. public static bool EsInteger(string theValue)
  2. {
  3. int value;
  4. return int.TryParse(theValue, out value);
  5. }

bueno espero les sea de gran ayuda.

nos vemos

6Aug/090

Saber cuanta memoria consume SQL Server MSSQL

para saber el consumo real SQL Server se debe de usar dbcc memorystatus como comando SQL, y nos dará el siguiente resultado de datos, en la primera sección Memory Manager valores expresados en Kb:

Buffer Distribution              Buffers
------------------------------   -----------
Stolen                           241
Free                             95
Procedures                       89
Inram                            0
Dirty                            16
Kept                             0
I/O                              0
Latched                          18
Other                            880

(9 row(s) affected)

para más info revisar esto http://support.microsoft.com/kb/271624.

El revisar el administrador de tareas no te dará el valor correcto del uso de la memoria del SQL server.

nos vemos.

5Aug/090

validar si hay texto en un textbox vb.net c#

Esta código ayuda a revisar si existe un texto ingresado en un textbox en VB.net y C#.

VB.NET:
  1. If TextBox.Text.Length <1 Then
  2. MessageBox.Show(Me, "Debe colocar un cliente válido", "error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
  3. Return
  4. End If

C#:
  1. if (TextBox.Text.Length <1)
  2. {
  3. MessageBox.Show(this, "Debe colocar un cliente válido", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  4. return;
  5. }

nos vemos espero les sirva algo sencillo pero muy útil.

Sigueme en Twitter

Recent Posts

Amigos de Twitter

_Narima
glorialonzo
xanderall
_Narima
glorialonzo
eljorgeluis
anissette
gnduran
wgavila
arigalt
machpablo
romerogt
WendyGalvez
anitagt
novell
google
lfer31
lexsoul
darkvander
SilvitaGG
Microsoft
mysql
AlcaldeArzu
axelopez
andreitaQC
magjogui
darkela
Ale928
titiburgos
rudygiron
josuepalacios
elsum
muniguate
mitsumits
saburack
veruku
Friends: 180 Followers: 280

Categories

Sitios amigos

Algunos Derechos Reservados

Blog bajo licencia Creative Commons Attribution-ShareAlike 3.0 License
Creative Commons License