Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Eleкtro

#9651
Cita de: Novlucker en 13 Enero 2013, 18:15 PM
Podrías pasar un object, pero no es para nada recomendable, donde vea que comienzas a hacer eso te baneo :xD)

Pero digo yo que no seré el primero en tener este problemilla xD... ¿Como lo solucionarías tú?  :-[

Que pocas soluciones hay entonces.

PD: gracias!

EDITO:
Citaren un rato me paso por tu post de snippets para darte unas sugerencias en cuanto a estructura de código :)
perfecto!
#9652
¿Se puede definir más de un tipo por Valor/Referencia por argumento?

Necesito hacer algo así:
Public Function blablabla(ByRef Image_File As String or As Bitmap)

O en su defecto:
Public Function blablabla(ByRef Image_File As "Cualquier tipo que séa aceptable")
If Image_File = Ctype(string) then...
if Image_File = Ctype(Bitmap) then...
#9653
A mi no me sale ninguna imagen, pero bueno xD.

Asegúrate de estar usando la versión correcta del intérprete de python, porque varios métodos y ordenes cambian.

Python 2.7.X
o
Python 3.X

Te recomiendo que uses la versión 2.7.X porque la mayoría de documentación/Ejemplos que encuentres estará escrita para esa versión...

Saludos.
#9654
Get OS Version

Código (vbnet) [Seleccionar]
        Dim OS_Version As String = System.Environment.OSVersion.ToString
        MsgBox(OS_Version)





String Is Email

Código (vbnet) [Seleccionar]
    ' // By Elektro H@cker
    '
    ' USAGE:
    '
    ' MsgBox(String_Is_Email("User@Email.com"))

#Region " String Is Email Function "

    Private Function String_Is_Email(ByVal Email_String As String)
        Dim Emaill_RegEx As New System.Text.RegularExpressions.Regex("^[A-Za-z0-9][A-Za-z0-9]+\@[A-Za-z0-9]+\.[A-Za-z0-9][A-Za-z0-9]+$")
        If Emaill_RegEx.IsMatch(Email_String) Then Return True Else Return False
    End Function

#End Region





Get Random Password

Código (vbnet) [Seleccionar]
    ' USAGE:
    '
    ' MsgBox(Get_Random_Password(8))
    ' MsgBox(Get_Random_Password(36))

#Region " Get Random Password Function "

    Public Function Get_Random_Password(ByVal Password_Length As Double) As String
        Dim New_Password As String = System.Guid.NewGuid.ToString
        If Password_Length <= 0 OrElse Password_Length > New_Password.Length Then
            Throw New ArgumentException("Length must be between 1 and " & New_Password.Length)
        End If
        Return New_Password.Substring(0, Password_Length)
    End Function

#End Region





Get Printers

Código (vbnet) [Seleccionar]
    ' // By Elektro H@cker
    '
    ' USAGE:
    '
    '  For Each Printer_Name In Get_Printers() : MsgBox(Printer_Name) : Next

    Private Function Get_Printers()
        Dim Printer_Array As New List(Of String)
        Try
            For Each Printer_Name As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters : Printer_Array.Add(Printer_Name) : Next
        Catch ex As Exception
            If ex.Message.Contains("RPC") Then Return "RPC Service is not avaliable"
        End Try
        Return Printer_Array
    End Function
#9655
Set_PC_State

Código (vbnet) [Seleccionar]

    ' // By Elektro H@cker

    ' USAGE:
    '
    ' Set_PC_State(RESET)
    ' Set_PC_State(SUSPEND, 30, "I'm suspending your system.")
    ' Set_PC_State(LOG_OFF)
    ' Set_PC_State(HIBERN)
    ' Set_PC_State(ABORT)

#Region " Set PC State "

    Const RESET As String = " -R "
    Const SUSPEND As String = " -S "
    Const LOG_OFF As String = " -L "
    Const HIBERN As String = " -H "
    Const ABORT As String = " -A "

    Private Function Set_PC_State(ByVal PowerState_Action As String, Optional ByVal TimeOut As Integer = 1, Optional ByVal COMMENT As String = "")

        Dim Shutdown_Command As New ProcessStartInfo
        Shutdown_Command.FileName = "Shutdown.exe"

        Try
            If PowerState_Action = ABORT Or PowerState_Action = HIBERN Or PowerState_Action = LOG_OFF Then
                Shutdown_Command.Arguments = PowerState_Action ' Windows don't allow TimeOut or Comment options for HIBERN, LOG_OFF or ABORT actions.
            ElseIf PowerState_Action = RESET Or PowerState_Action = SUSPEND Then
                If Not COMMENT = "" Then
                    If COMMENT.Length > 512 Then COMMENT = COMMENT.Substring(0, 512) ' Only 512 chars are allowed for comment
                    Shutdown_Command.Arguments = PowerState_Action & " -T " & TimeOut & " /C " & COMMENT
                Else
                    Shutdown_Command.Arguments = PowerState_Action & " -T " & TimeOut
                End If
                Shutdown_Command.WindowStyle = ProcessWindowStyle.Hidden
                Process.Start(Shutdown_Command)
                Return True
            End If
        Catch ex As Exception
            Return ex.Message
        End Try

        Return Nothing ' Invalid argument
    End Function

#End Region







Día local:

Código (vbnet) [Seleccionar]

Dim Today as string = My.Computer.Clock.LocalTime.DayOfWeek ' In English language

Dim Today as string = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetDayName(Date.Today.DayOfWeek) ' In system language






String is URL?

Código (vbnet) [Seleccionar]
    ' USAGE:
    '
    ' If String_Is_URL("http://google.com") Then MsgBox("Valid url!") Else MsgBox("Invalid url!")

#Region " String Is URL Function "

    Private Function String_Is_URL(ByVal STR As String)
        Dim URL_Pattern As String = "^(http|https):/{2}[a-zA-Z./&\d_-]+"
        Dim URL_RegEx As New System.Text.RegularExpressions.Regex(URL_Pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.ExplicitCapture)
        If URL_RegEx.IsMatch(STR) Then Return True Else Return False
    End Function

#End Region






G-Mail Sender (Envía emails)

Código (vbnet) [Seleccionar]
    ' USAGE:
    '
    ' GMail_Sender("Your_Email@Gmail.com", "Your_Password", "Email Subject", "Message Body", "Destiny@Email.com")

#Region " GMail Sender function "

    Private Function GMail_Sender(ByVal Gmail_Username As String, ByVal Gmail_Password As String, ByVal Email_Subject As String, ByVal Email_Body As String, ByVal Email_Destiny As String)
        Try
            Dim MailSetup As New System.Net.Mail.MailMessage
            MailSetup.Subject = Email_Subject
            MailSetup.To.Add(Email_Destiny)
            MailSetup.From = New System.Net.Mail.MailAddress(Gmail_Username)
            MailSetup.Body = Email_Body
            Dim SMTP As New System.Net.Mail.SmtpClient("smtp.gmail.com")
            SMTP.Port = 587
            SMTP.EnableSsl = True
            SMTP.Credentials = New Net.NetworkCredential(Gmail_Username, Gmail_Password)
            SMTP.Send(MailSetup)
            Return True ' Email is sended OK
        Catch ex As Exception
            Return ex.Message ' Email can't be sended
        End Try
    End Function

#End Region


#9656
Gracias ^^, sabía que habría que utilizar lo del cultureinfo pero no sabía como xD.
#9657
nah ya está, el autor me ha dicho que el método ".click" en este control es ".clickbuttonarea"

xD

Saludos
#9658
¿Se puede obtener este dato en el idioma instalado del equipo?

My.Computer.Clock.LocalTime.DayOfWeek
#9659
Otro convertidor, en esta ocasión un convertidor de tiempo, ms, segundos, minutos, horas.


Código (VBNET) [Seleccionar]
#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