Combobox Read Only
private void cbxTipo_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
** Claro esto no permite escribir por las iniciales de los puertos e ir completando
jueves, 18 de diciembre de 2014
jueves, 16 de octubre de 2014
Datagridview Excepcion al Intentar Ordenar elementos
Datagridview Excepcion al Intentar Ordenar elementos
Editar en Columns, Collection, SortMode = NotSortable
Editar en Columns, Collection, SortMode = NotSortable
miércoles, 15 de octubre de 2014
Validaciones usando Regex
Entrada alphanumérica (sin caracteres especiales): Aceptando letras de A-Z (mayúsculas y minúsculas), números 0-9, y la tecla backspace.
private void alphaNumericTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var regex = new Regex(@"[^a-zA-Z0-9\b]");
if (regex.IsMatch(e.KeyChar.ToString()))
{
e.Handled = true;
}
}
Entrada alphanumérica (separada por espacios, sin caracteres especiales): Aceptando letras de A-Z (mayúsculas y minúsculas), números 0-9, espacio y la tecla backspace.
private void alphaNumericPlusSpaceTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var regex = new Regex(@"[^a-zA-Z0-9\x20\b]");
if (regex.IsMatch(e.KeyChar.ToString()))
{
e.Handled = true;
}
}
Dirección Ip:
if (!(string.IsNullOrEmpty(txbIpAddress.Text)) && (Regex.IsMatch(txbIpAddress.Text, @"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b")))
{
RegECRUdp(1, txbIpAddress.Text, "", 5002, false);
testResult = TransTestComm(1, 0);
}
else
{
MessageBox.Show("Dirección Ip inválida.");
return;
}
Email:
private void txbEmail_Validating(object sender, CancelEventArgs e)
{
string email = txbEmail.Text;
Regex regex1 = new Regex(@"\A[a-z0-9]+([-._][a-z0-9]+)*@([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,4}\z");
Regex regex2 = new Regex(@"^(?=.{1,64}@.{4,64}$)(?=.{6,100}$).*");
Match match1 = regex1.Match(email);
Match match2 = regex2.Match(email);
if (match1.Success && match2.Success)
{
lblEmail.ForeColor = Color.Black;
lblRequiredFieldForInfoStore3.ForeColor = Color.Goldenrod;
}
else
{
lblEmail.ForeColor = Color.Red;
lblRequiredFieldForInfoStore3.ForeColor = Color.Red;
return;
}
}
Regular Expression Library: Buscador de expresiones regulares
http://regexlib.com/
private void alphaNumericTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var regex = new Regex(@"[^a-zA-Z0-9\b]");
if (regex.IsMatch(e.KeyChar.ToString()))
{
e.Handled = true;
}
}
Entrada alphanumérica (separada por espacios, sin caracteres especiales): Aceptando letras de A-Z (mayúsculas y minúsculas), números 0-9, espacio y la tecla backspace.
private void alphaNumericPlusSpaceTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var regex = new Regex(@"[^a-zA-Z0-9\x20\b]");
if (regex.IsMatch(e.KeyChar.ToString()))
{
e.Handled = true;
}
}
Dirección Ip:
if (!(string.IsNullOrEmpty(txbIpAddress.Text)) && (Regex.IsMatch(txbIpAddress.Text, @"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b")))
{
RegECRUdp(1, txbIpAddress.Text, "", 5002, false);
testResult = TransTestComm(1, 0);
}
else
{
MessageBox.Show("Dirección Ip inválida.");
return;
}
Email:
private void txbEmail_Validating(object sender, CancelEventArgs e)
{
string email = txbEmail.Text;
Regex regex1 = new Regex(@"\A[a-z0-9]+([-._][a-z0-9]+)*@([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,4}\z");
Regex regex2 = new Regex(@"^(?=.{1,64}@.{4,64}$)(?=.{6,100}$).*");
Match match1 = regex1.Match(email);
Match match2 = regex2.Match(email);
if (match1.Success && match2.Success)
{
lblEmail.ForeColor = Color.Black;
lblRequiredFieldForInfoStore3.ForeColor = Color.Goldenrod;
}
else
{
lblEmail.ForeColor = Color.Red;
lblRequiredFieldForInfoStore3.ForeColor = Color.Red;
return;
}
}
Regular Expression Library: Buscador de expresiones regulares
http://regexlib.com/
Etiquetas:
.Net,
C#,
Expresiones regulares,
KeyPress,
Regex,
Regular expressions,
Textbox,
Validating
martes, 30 de septiembre de 2014
Remover u Ocultar Pestaña
Si por ejemplo se quiere ocultar o realmente remover cierta pestaña
tabControl1.TabPages.RemoveAt(8);
Tambien se puede hacer de esta manera
jueves, 18 de septiembre de 2014
Delegados
http://geeks.ms/blogs/etomas/archive/2010/07/21/c-b-225-sico-delegates.aspx (Importante)
http://www.akadia.com/services/dotnet_delegates_and_events.html
http://www.tutorialspoint.com/csharp/csharp_delegates.htm
http://msdn.microsoft.com/es-es/library/ms173171.aspx
http://msdn.microsoft.com/es-es/library/900fyy8e.aspx
http://msdn.microsoft.com/en-us/library/aa288459(v=vs.71).aspx
https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived(v=vs.110).aspx
http://mattwarren.org/2017/01/25/How-do-.NET-delegates-work/ (explicación de delegados)
Estudiando:
C# 6.0 in a Nutshell
Cap 4
Importante, muy buenos detalles
http://www.akadia.com/services/dotnet_delegates_and_events.html
http://www.tutorialspoint.com/csharp/csharp_delegates.htm
http://msdn.microsoft.com/es-es/library/ms173171.aspx
http://msdn.microsoft.com/es-es/library/900fyy8e.aspx
http://msdn.microsoft.com/en-us/library/aa288459(v=vs.71).aspx
https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived(v=vs.110).aspx
http://mattwarren.org/2017/01/25/How-do-.NET-delegates-work/ (explicación de delegados)
Estudiando:
C# 6.0 in a Nutshell
Cap 4
Importante, muy buenos detalles
viernes, 5 de septiembre de 2014
Globalización y Localización
Qué es Globalización?
Qué es Localización?
Diferencias entre Globalización y Localización
- Cuando se está utilizando la localizaion y Windows Forms, al modificar el formulario (Default) se afectan a todos los demás recursos de dicho formulario localizado.
Lista de Culture Info soportados por Windows
National Language Support (NLS) API Reference
Lista de Códigos de Países según ISO
http://es.wikipedia.org/wiki/ISO_3166-1
Cuando se necesita crear CultureInfo, pues no están en la lista de Localización se basa en esta clase de .NET
CultureAndRegionInfoBuilder Class, ver CultureInfo, palabras claves Custom Culture
Leer para agregar los resources
http://books.google.co.ve/books?id=VL3pIDstrQsC&pg=PA181&lpg=PA181&dq=c%23+register+custom+culture&source=bl&ots=7V0SQnvBok&sig=ArDoXJO5bvh_m1tEmFDcqKzGByc&hl=es-419&sa=X&ei=pfdqU_WYDtStyATvwoCwDw&ved=0CG4Q6AEwBg#v=onepage&q=c%23%20register%20custom%20culture&f=false
http://tutorials.csharp-online.net/Using_Custom_Cultures%E2%80%94Installing_and_Registering_Custom_Cultures
http://www.codeproject.com/Articles/66277/Creating-Extending-a-Culture
http://msdn.microsoft.com/en-us/library/ms172469%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/vstudio/ms404375%28v=vs.100%29.aspx
http://blogs.msdn.com/b/shawnste/archive/2005/11/23/496440.aspx
http://www.codeproject.com/Articles/15175/NET-Internationalization-The-Developer-s-Guide-to
http://msdn.microsoft.com/es-es/library/ms404375(v=vs.90).aspx
http://www.countrycodesfinder.com/country-ISO-codes.html (Codigos ISO por Regiones)
http://tutorials.csharp-online.net/Using_Custom_Cultures%E2%80%94Installing_and_Registering_Custom_Cultures
http://www.codeproject.com/Articles/66277/Creating-Extending-a-Culture
http://msdn.microsoft.com/en-us/library/ms172469%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/vstudio/ms404375%28v=vs.100%29.aspx
http://blogs.msdn.com/b/shawnste/archive/2005/11/23/496440.aspx
http://www.codeproject.com/Articles/15175/NET-Internationalization-The-Developer-s-Guide-to
http://msdn.microsoft.com/es-es/library/ms404375(v=vs.90).aspx
http://www.countrycodesfinder.com/country-ISO-codes.html (Codigos ISO por Regiones)
martes, 2 de septiembre de 2014
ADO .NET
C# and NET 4 (Chapter 30) Core ADO.NET
C# 2010 and the NET Platform (Chapter 22)
http://www.telerik.com/help/winforms/treeview-data-binding-data-binding-basics.html
http://msdn.microsoft.com/en-us/library/ms752347%28v=vs.110%29.aspx#validation_rules
C# 2010 and the NET Platform (Chapter 22)
http://www.telerik.com/help/winforms/treeview-data-binding-data-binding-basics.html
http://msdn.microsoft.com/en-us/library/ms752347%28v=vs.110%29.aspx#validation_rules
Suscribirse a:
Entradas (Atom)