|
9961
|
Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 12/01/2013) Posteen aquí sus snippets!!
|
en: 12 Enero 2013, 20:36 pm
|
Otro convertidor, en esta ocasión un convertidor de tiempo, ms, segundos, minutos, horas. #Region " Convert Time Function" ' // By Elektro H@cker ' ' MsgBox(Convert_Time(1, "h", "m")) ' MsgBox(Convert_Time(1, "h", "s")) ' MsgBox(Convert_Time(1, "h", "ms")) ' MsgBox(Convert_Time(6000, "milliseconds", "seconds")) ' MsgBox(Convert_Time(6000, "seconds", "minutes")) ' MsgBox(Convert_Time(6000, "minutes", "hours")) Private Function Convert_Time(ByVal Time As Int64, ByVal Input_Time_Format As String, ByVal Output_Time_Format As String) Dim Time_Span As New TimeSpan If Input_Time_Format.ToUpper = "MS" Or Output_Time_Format.ToUpper = "MILLISECONDS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerMillisecond * Time) If Input_Time_Format.ToUpper = "S" Or Output_Time_Format.ToUpper = "SECONDS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerSecond * Time) If Input_Time_Format.ToUpper = "M" Or Output_Time_Format.ToUpper = "MINUTES" Then Time_Span = New TimeSpan(TimeSpan.TicksPerMinute * Time) If Input_Time_Format.ToUpper = "H" Or Output_Time_Format.ToUpper = "HOURS" Then Time_Span = New TimeSpan(TimeSpan.TicksPerHour * Time) If Output_Time_Format.ToUpper = "MS" Or Output_Time_Format.ToUpper = "MILLISECONDS" Then Return Time_Span.TotalMilliseconds If Output_Time_Format.ToUpper = "S" Or Output_Time_Format.ToUpper = "SECONDS" Then Return Time_Span.TotalSeconds If Output_Time_Format.ToUpper = "M" Or Output_Time_Format.ToUpper = "MINUTES" Then Return Time_Span.TotalMinutes If Output_Time_Format.ToUpper = "H" Or Output_Time_Format.ToUpper = "HOURS" Then Return Time_Span.TotalHours Return False ' Returns false if argument is in incorrect format End Function #End Region
|
|
|
9964
|
Programación / .NET (C#, VB.NET, ASP) / [solucionado] Como simular el método "performclick" de un botón?
|
en: 12 Enero 2013, 18:17 pm
|
Hola, Estoy usando un botón extendido que no dispone del método "performclick" Esto no puedo hacerlo: If "a" = "a" then Button1.performclick()
Puedo escribir el método y no me salta excepción, pero no sucede nada, y he leido el mismo tipo de problema en la página del autor, en CodeProject. La pregunta es... ¿Puedo simularlo de alguna manera? (Que no séa clickando el botón por coordenadas...  ) Dispongo del source del botón, por si saben como implementar el método... Gracias por leer.
|
|
|
9965
|
Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 12/01/2013) Posteen aquí sus snippets!!
|
en: 12 Enero 2013, 18:00 pm
|
He actualizado el pack de Snippets en el post principal (Antes eran 76, ahora 114) Si alguien quiere que incluya un pack con sus snippets en el post principal porfavor que me pase los snippets en formato de snippet (Archivo.snippet). Y añado este snippet, un delimitador de strings, es parecido al método "Split", pero bajo mi opinión lo he mejorado bastante! · Acepta 1 o 2 delimitadores, · Opción de IgnoreCase · Delimitar de izquierda a derecha o de derecha a izquierda. Saludos! #Region " Delimit_String Function " ' // By Elektro H@ker ' ' USAGE: ' ' MsgBox(Delimit_String("Welcome to my new house", "to")) ' my new house ' MsgBox(Delimit_String("Welcome to my new house", "to", "house")) ' my new ' MsgBox(Delimit_String("Welcome to my new house", "TO", "HoUSe", True)) ' my new ' MsgBox(Delimit_String("Welcome to my new house", "house", "to", , "Left")) ' my new ' MsgBox(Delimit_String("Welcome to my new house", "TO", "HoUSe", False)) ' False ' MsgBox(Delimit_String("Welcome to my new house", "to", "to", , "Left")) ' Index was outside bounds of the array Private Function Delimit_String(ByVal STR As String, ByVal Delimiter_A As String, Optional ByVal Delimiter_B As String = "", Optional ByVal Ignore_Case As Boolean = False, Optional ByVal Left_Or_Right As String = "Right") Dim Compare_Method As Integer = 0 ' Don't ignore case If Ignore_Case = True Then Compare_Method = 1 ' Ignore Case If Not Left_Or_Right.ToUpper = "LEFT" And Not Left_Or_Right.ToUpper = "RIGHT" _ Then Return False ' Returns false if the Left_Or_Right argument is in incorrect format If Compare_Method = 0 Then If Not STR.Contains(Delimiter_A) Or Not STR.Contains(Delimiter_B) _ Then Return False ' Returns false if one of the delimiters in NormalCase can 't be found Else If Not STR.ToUpper.Contains(Delimiter_A.ToUpper) Or Not STR.ToUpper.Contains(Delimiter_B.ToUpper) _ Then Return False ' Returns false if one of the delimiters in IgnoreCase can 't be found End If Try If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(0) _ Else If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(1) If Delimiter_B IsNot Nothing Then If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(1) _ Else If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(0) End If Return STR ' Returns the splitted string Catch ex As Exception Return ex.Message ' Returns exception if index is out of range End Try End Function #End Region
|
|
|
9967
|
Programación / .NET (C#, VB.NET, ASP) / Re: Duda con conseguir un certificado de windows
|
en: 12 Enero 2013, 16:48 pm
|
Hola,
Respondo a tu privado: "Sé de lo que hablas pero yo soy nuevo en .NET, todavía no he profundizado en certificados xD"
Y añado: Hay utilidades commandline de terceros (Y de Microsoft) para firmar digitalmente un ejecutable, No recuerdo el nombre de ninguna de estas tools, tampoco sé si es exactamente lo que necesitas, pero ya tienes algo que buscar en Google jaja.
PD: En uno de los Windows SDK Tools encuentras la utilidad de Microsoft, era algo como signer.exe o sign.exe, y en una utilidad de terceros commandline, tenía un servicio online donde te generaba una key automáticamente, si no recuerod mal.
Saludos!
|
|
|
9969
|
Programación / .NET (C#, VB.NET, ASP) / Re: Tomar texto de un punto a otro en vb.net
|
en: 12 Enero 2013, 15:16 pm
|
Creo que esto es lo que quiero según tus indicaciones: Dim STR As String = "bienvenidos todos a mi nueva casa de color verde" Dim Delimitador_A As String = "todos" Dim Delimitador_B As String = "verde" STR = Split(STR, Delimitador_A, , CompareMethod.Text)(1) ' Aquí tomo todo lo que hay a la derecha del primer delimitador STR = Split(STR, Delimitador_B, , CompareMethod.Text)(0) ' Aquí tomo todo lo que hay a la izquierda del segundo delimitador MsgBox(STR) ' a mi nueva casa de color
Saludos! EDITO:Te lo voy a poner más fácil: #Region " Delimit_String Function " ' // By Elektro H@ker ' ' USAGE: ' ' MsgBox(Delimit_String("Bienvenidos todos a mi nueva casa de color verde", "todos")) ' a mi nueva casa de color verde ' MsgBox(Delimit_String("Bienvenidos todos a mi nueva casa de color verde", "todos", "verde")) ' a mi nueva casa de color ' MsgBox(Delimit_String("Bienvenidos todos a mi nueva casa de color verde", "ToDoS", "VeRDe", True)) ' a mi nueva casa de color ' MsgBox(Delimit_String("Bienvenidos todos a mi nueva casa de color verde", "ToDoS", "VeRDe", False)) ' False ' MsgBox(Delimit_String("Bienvenidos todos a mi nueva casa de color verde", "verde", "todos", , "Left")) ' a mi nueva casa de color Private Function Delimit_String(ByVal STR As String, ByVal Delimiter_A As String, Optional ByVal Delimiter_B As String = Nothing, Optional ByVal Ignore_Case As Boolean = False, Optional ByVal Left_Or_Right As String = "Right") Dim Compare_Method As Integer = 0 ' Don't ignore case If Ignore_Case = True Then Compare_Method = 1 ' Ignore Case If Not Left_Or_Right.ToUpper = "LEFT" And Not Left_Or_Right.ToUpper = "RIGHT" Then Return False ' Returns false if the Left_Or_Right argument is in incorrect format Try If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(1) _ Else If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_A, , Compare_Method)(0) If Delimiter_B IsNot Nothing Then If Left_Or_Right.ToUpper = "RIGHT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(0) _ Else If Left_Or_Right.ToUpper = "LEFT" Then STR = Split(STR, Delimiter_B, , Compare_Method)(1) End If Return STR ' Returns the splitted string Catch Return False ' Returns false if the delimiter "A" or "B" can't be found (Index is out or fange) End Try End Function #End Region
|
|
|
|
|
|
|