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

#7771
Cita de: wolfbcn en 23 Octubre 2013, 21:53 PMque los medios 'online' se tengan que responsabilizar de los comentarios ofensivos publicados por sus lectores

El mundo se ha vuelto loco, y para colmo lo avala un "tribunal de derechos humanos", que con ese nombre se supone que debería ser un grupo de personas con dos ***** dedos de conocimiento para comprender que una persona no se puede responsabilizar de los actos de otra tercera persona.

Es como si un loco ve un coche que no le gusta en un concesionario y decide poner una bomba en el coche, claro, según este "tribunal de derechos humanos", con mucha lógica, la culpa y la condena carcelaria sería para el encargado del concesionario, por poner el coche ahi para que otras personas puedan verlo, olerlo, tocarlo, y opinar sobre él... en fín, mundo de hipocritas y descerebrados.

Saludos!
#7772
Cita de: washington8277 en 26 Octubre 2013, 08:17 AMMi inquietud era si hay manera de poder cambiar la información del sistema (os)
no porque quiero estafar a alguien simplemente por ser un curioso, me gusta ver como funciona el os demi pc explorar curiosear.

Editar el valor de unas claves de registro con intención de falsear información de un par de etiquetas OEM del panel de control no te puede ayudar a aprender como funciona un sistema operativo... es una completa estupidez.
Si quieres aprender algo útil, entonces coje un manual del Regedit o del funcionamiento de Windows y empieza a leer.

Un saludo!
#7773
Foro Libre / Re: internet en la luna
25 Octubre 2013, 17:28 PM
CitarLa Luna ya tiene Internet

Y a todo esto, ¿para que narices quieren establecer Internet en la Luna?, ¿Quizás para hacer streamings en directo de partidos de fútbol con pelotas de roca Lunar?...

Ya me lo veo venir en un futuro no muy lejano (o quizás si, muy lejano)... el Moonball señores!

Un saludo!
#7774
Una función genérica para agregar un item a un array de 2 dimensiones

Código (vbnet) [Seleccionar]
#Region " Add Item Array 2D "

   ' [ Add Item Array 2D ]
   '
   ' // By Elektro H@cker
   '
   ' Examples :
   '
   '// Create an Array 2D (2,2)
   ' Dim MyArray As String(,) = {{"Item 0,0", "Item 0,1"}, {"Item 1,0", "Item 1,1"}, {"Item 2,0", "Item 2,1"}}
   '// Add an Item
   ' Add_Item_Array_2D(MyArray, {"Item 3,0", "Item 3,1"})

   Private Sub Add_Item_Array_2D(ByRef Array_2D As String(,), _
                                 ByVal Items As String())

       Dim tmp_array(Array_2D.GetUpperBound(0) + 1, Array_2D.GetUpperBound(1)) As String

       For x As Integer = 0 To Array_2D.GetUpperBound(0)
           tmp_array(x, 0) = Array_2D(x, 0)
           tmp_array(x, 1) = Array_2D(x, 1)
       Next

       For x As Integer = 0 To Items.Count - 1
           tmp_array(tmp_array.GetUpperBound(0), x) = Items(x)
       Next

       Array_2D = tmp_array

   End Sub

#End Region







Un ejemplo de como ordenar un documento XML según un elemento dado:

Código (vbnet) [Seleccionar]
#Region " Sort XML By Element "

   ' [ Sort XML By Element ]
   '
   ' // By Elektro H@cker
   '
   ' Example usage :
   ' Dim XML As XDocument = Sort_XML_By_Element(XDocument.Load("C:\File.xml"), "Song", "Name")

   ' Example XML File:
   '
   '<?xml version="1.0" encoding="Windows-1252"?>
   '<Songs>
   '    <Song><Name>My Song 2.mp3</Name><Year>2007</Year></Song>
   '    <Song><Name>My Song 1.mp3</Name><Year>2009</Year></Song>
   '    <Song><Name>My Song 3.mp3</Name><Year>2008</Year></Song>
   '</Songs>

   ' Example output:
   '
   '<?xml version="1.0" encoding="Windows-1252"?>
   '<Songs>
   '    <Song><Name>My Song 1.mp3</Name><Year>2009</Year></Song>
   '    <Song><Name>My Song 2.mp3</Name><Year>2007</Year></Song>
   '    <Song><Name>My Song 3.mp3</Name><Year>2008</Year></Song>
   '</Songs>

   Private Function Sort_XML_By_Element(ByVal XML As XDocument, _
                                    ByVal Root_Element As String, _
                                    ByVal Element_to_sort As String) As XDocument

       Dim xdoc As XDocument

       Try

           xdoc = XML
           xdoc.Root.ReplaceNodes(XML.Root.Elements(Root_Element) _
                                 .OrderBy(Function(sort) sort.Element(Element_to_sort).Value))

           Return xdoc

       Catch ex As Exception
           Throw New Exception(ex.Message)

       Finally
           xdoc = Nothing

       End Try

   End Function

#End Region







Un ejemplo de como convertir los elementos de un documento XML a un type anónimo:

Código (vbnet) [Seleccionar]
#Region " Convert XML to Anonymous Type "

       'Dim xml As XDocument = XDocument.Load(xmlfile)

       Dim xml As XDocument = _
       <?xml version="1.0" encoding="Windows-1252"?>
       <!--XML Songs Database.-->
       <Songs>
           <Song><Name>My Song 1.mp3</Name><Year>2007</Year><Genre>Dance</Genre><Bitrate>320</Bitrate><Length>04:55</Length><Size>4,80</Size></Song>
           <Song><Name>My Song 2.mp3</Name><Year>2009</Year><Genre>Electro</Genre><Bitrate>192</Bitrate><Length>06:44</Length><Size>8,43</Size></Song>
           <Song><Name>My Song 3.mp3</Name><Year>2008</Year><Genre>UK Hardcore</Genre><Bitrate>128</Bitrate><Length>05:12</Length><Size>4,20</Size></Song>
       </Songs>

       Dim SongsList = From song In xml.<Songs>.<Song>
                       Select New With { _
                                         song.<Name>.Value,
                                         song.<Year>.Value,
                                         song.<Genre>.Value,
                                         song.<Bitrate>.Value,
                                         song.<Length>.Value,
                                         song.<Size>.Value _
                                      }

       For Each song In SongsList

           MsgBox(String.Format("Name:{1}{0}Year:{2}{0}Genre:{3}{0}Bitrate:{4}{0}Length:{5}{0}Size:{6}", _
                                Environment.NewLine, _
                                song.Name, song.Year, song.Genre, song.Bitrate, song.Length, song.Size))

           ' Output:
           '
           'Name:My Song 1.mp3
           'Year:2007
           'Genre:Dance
           'Bitrate:320
           'Length:04:55
           'Size:4,80

       Next

#End Region







Un ejemplo de como convertir los elementos de un documento XML a Tuplas

Código (vbnet) [Seleccionar]
#Region " Convert XML to IEnumerable(Of Tuple) "

       'Dim xml As XDocument = XDocument.Load(xmlfile)

       Dim xml As XDocument = _
       <?xml version="1.0" encoding="Windows-1252"?>
       <!--XML Songs Database.-->
       <Songs>
           <Song><Name>My Song 1.mp3</Name><Year>2007</Year><Genre>Dance</Genre><Bitrate>320</Bitrate><Length>04:55</Length><Size>4,80</Size></Song>
           <Song><Name>My Song 2.mp3</Name><Year>2009</Year><Genre>Electro</Genre><Bitrate>192</Bitrate><Length>06:44</Length><Size>8,43</Size></Song>
           <Song><Name>My Song 3.mp3</Name><Year>2008</Year><Genre>UK Hardcore</Genre><Bitrate>128</Bitrate><Length>05:12</Length><Size>4,20</Size></Song>
       </Songs>

       Dim SongsList As IEnumerable(Of Tuple(Of String, String, String, String, String, String)) = _
           From song In xml.<Songs>.<Song>
           Select Tuple.Create( _
                                song.<Name>.Value,
                                song.<Year>.Value,
                                song.<Genre>.Value,
                                song.<Bitrate>.Value,
                                song.<Length>.Value,
                                song.<Size>.Value _
                              )

       For Each song In SongsList

           MsgBox(String.Format("Name:{1}{0}Year:{2}{0}Genre:{3}{0}Bitrate:{4}{0}Length:{5}{0}Size:{6}", _
                                Environment.NewLine, _
                                song.Item1, song.Item2, song.Item3, song.Item4, song.Item5, song.Item6))

           ' Output:
           '
           'Name:My Song 1.mp3
           'Year:2007
           'Genre:Dance
           'Bitrate:320
           'Length:04:55
           'Size:4,80

       Next

#End Region







Un ejemplo de como usar Arrays 2D

Código (vbnet) [Seleccionar]
       ' Create Array 2D (2,2)
       Dim MyArray As String(,) = {{"Item 0,0", "Item 0,1"}, {"Item 1,0", "Item 1,1"}, {"Item 2,0", "Item 2,1"}}

       ' Set value
       MyArray(0, 1) = "New Item 0,1"

       ' Get Value
       MsgBox(MyArray(0, 1))

       ' Loop over the Array 2D
       For x As Integer = 0 To MyArray.GetUpperBound(0)
           MsgBox(String.Format("Array 2D {1},0: {2}{0}Array 2D {1},1: {3}", Environment.NewLine, _
                               x, MyArray(x, 0), MyArray(x, 1)))
       Next







Un ejemplo de como crear un Type propio:

Código (vbnet) [Seleccionar]
   Public Class Type1

       Private _Name As String
       Private _Age As Short

       Public Property Name() As String
           Get
               Return _Name
           End Get
           Set(ByVal value As String)
               _Name = value
           End Set
       End Property

       Public Property Age() As Short
           Get
               Return _Age
           End Get
           Set(ByVal value As Short)
               _Age = value
           End Set
       End Property

   End Class

   'Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   '
   '    ' Create a list of our own Type and add Elements:
   '    Dim Contacts As New List(Of Type1) From { _
   '        New Type1 With {.Name = "Lucia", .Age = 19}, _
   '        New Type1 With {.Name = "Pepe", .Age = 40} _
   '    }
   '
   '    ' Add another Element
   '    Contacts.Add(New Type1 With {.Name = "Pablo", .Age = 32})
   '
   '    ' Find an Element:
   '    Dim Contact As Type1 = Contacts.Find(Function(x) x.Name = "Lucia")
   '
   '    ' Display Element members:
   '    MsgBox(String.Format("Name: {1}{0}Age: {2}", _
   '                         Environment.NewLine, _
   '                         Contact.Name, Contact.Age))
   '
   '    ' Loop over all Elements:
   '    For Each Element As Type1 In Contacts
   '        MsgBox(String.Format("Name: {1}{0}Age: {2}", _
   '                        Environment.NewLine, _
   '                        Element.Name, Element.Age))
   '    Next
   '
   'End Sub






Una función genérica para obtener el serial de la CPU
(Este snippet fue de los primeros que posteé, le he dado un repaso al código)

Código (vbnet) [Seleccionar]
   #Region " Get CPU ID "
   
      ' [ Get CPU ID ]
      '
      '// By Elektro H@cker
      '
      ' INSTRUCTIONS:
      ' 1. Add a reference to "System.Management"
      '
      ' Examples :
      ' Dim ProcID As String = Get_CPU_ID()
      ' MsgBox(Get_CPU_ID())
   
   Private Function Get_CPU_ID() As String

       Dim wmi As Management.ManagementObjectSearcher = _
           New Management.ManagementObjectSearcher("select * from Win32_Processor")

       Dim val As String = wmi.Get(0)("ProcessorID")

       wmi.Dispose()

       Return val.ToString

   End Function
   
   #End Region







Una función genérica para obtener el serial de la placa base
(Este snippet fue de los primeros que posteé, le he dado un repaso al código)

Código (vbnet) [Seleccionar]
   #Region " Get Motherboard ID "
   
      ' [ Get Motherboard ID ]
      '
      '// By Elektro H@cker
      '
      ' INSTRUCTIONS:
      ' 1. Add a reference to "System.Management"
      '
      ' Examples :
      ' Dim MotherID As String = Get_Motherboard_ID()
      ' MsgBox(Get_Motherboard_ID())
   
   Private Function Get_Motherboard_ID() As String

       Dim wmi As Management.ManagementObjectSearcher = _
           New Management.ManagementObjectSearcher("select * from Win32_BaseBoard")

       Dim val As String = wmi.Get(0)("SerialNumber")

       wmi.Dispose()

       Return val

   End Function
   
   #End Region







Y por último, unos ejemplos muy sencillos de como manejar un documento XML (sencillo)...
(Uso un XMLTextWritter en lugar de un XMLWriter por la libertad de indentación)

Código (vbnet) [Seleccionar]
' [ Song XML Writer Helper ]
'
' // By Elektro H@cker
'
' Example usage :
'
'Private Sub Test()
'
'    ' Set an XML file to create
'    Dim xmlfile As String = "C:\My XML File.xml"
'
'    ' Create the XmlWriter object
'    Dim XmlWriter As Xml.XmlTextWriter = _
'        New Xml.XmlTextWriter(xmlfile, System.Text.Encoding.Default) _
'        With {.Formatting = Xml.Formatting.Indented}
'
'    ' Write the Xml declaration.
'    XMLHelper.Write_Beginning(XmlWriter)
'    ' Output at this point:
'    ' <?xml version="1.0" encoding="Windows-1252"?>
'
'    ' Write a comment.
'    XMLHelper.Write_Comment(XmlWriter, "XML Songs Database", Xml.Formatting.Indented)
'    ' Output at this point:
'    ' <!--XML Songs Database-->
'
'    ' Write the root element.
'    XMLHelper.Write_Beginning_Root_Element(XmlWriter, "Songs", Xml.Formatting.Indented)
'    ' Output at this point:
'    ' <Songs>
'
'    ' Write the start of a song element.
'    XMLHelper.Write_Beginning_Root_Element(XmlWriter, "Song", Xml.Formatting.Indented)
'    ' Output at this point:
'    ' <Song>
'
'    ' Write a song element.
'    XMLHelper.Write_Elements(XmlWriter, { _
'                                         {"Name", "My Song file.mp3"}, _
'                                         {"Year", "2013"}, _
'                                         {"Genre", "Rock"} _
'                                        }, Xml.Formatting.None)       
'    ' Output at this point:
'    ' <Name>My Song file.mp3</Name><Year>2007</Year><Genre>Dance</Genre>
'
'    ' Write the end of a song element.
'    XMLHelper.Write_End_Root_Element(XmlWriter, Xml.Formatting.None)
'    ' Output at this point:
'    ' </Song>
'
'    ' Write the end of the Root element.
'    XMLHelper.Write_End_Root_Element(XmlWriter, Xml.Formatting.Indented)
'    ' Output at this point:
'    ' </Songs>
'
'    ' Write the xml end of file.
'    XMLHelper.Write_End(XmlWriter)
'
'    ' Start the file and exit
'    Process.Start(xmlfile) : Application.Exit()
'
'    ' Final output:
'    '
'    '<?xml version="1.0" encoding="Windows-1252"?>
'    '<!--XML Songs Database-->
'    '<Songs>
'    '  <Song><Name>My Song file.mp3</Name><Year>2007</Year><Genre>Dance</Genre></Song>
'    '</Songs>
'
'End Sub

#Region " XML Helper "

Class XMLHelper

    ''' <summary>
    ''' Writes the Xml beginning declaration.
    ''' </summary>
    Shared Sub Write_Beginning(ByVal XmlWriter As Xml.XmlTextWriter)

        Try
            XmlWriter.WriteStartDocument()

        Catch ex As InvalidOperationException
            Dim errormsg As String = "This is not the first write method called after the constructor. "
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes a comment.
    ''' </summary>
    Shared Sub Write_Comment(ByVal XmlWriter As Xml.XmlTextWriter, _
                                  ByVal Comment As String, _
                                  Optional ByVal Indentation As Xml.Formatting = Xml.Formatting.Indented)

        Try
            XmlWriter.Formatting = Indentation
            XmlWriter.WriteComment(Comment)
            XmlWriter.Formatting = Not Indentation

        Catch ex As ArgumentException
            Dim errormsg As String = "The text would result in a non-well formed XML document"
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As InvalidOperationException
            Dim errormsg As String = "The ""WriteState"" property is Closed"
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes the beginning of a root element.
    ''' </summary>
    Shared Sub Write_Beginning_Root_Element(ByVal XmlWriter As Xml.XmlTextWriter, _
                                                 ByVal Element As String, _
                                                 Optional ByVal Indentation As Xml.Formatting = Xml.Formatting.Indented)

        Try
            XmlWriter.Formatting = Indentation
            XmlWriter.WriteStartElement(Element)
            XmlWriter.Formatting = Not Indentation

        Catch ex As System.Text.EncoderFallbackException
            Dim errormsg As String = "There is a character in the buffer that is a valid XML character but is not valid for the output encoding."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As InvalidOperationException
            Dim errormsg As String = "The XmlTextWriter is closed or An XmlTextWriter method was called before a previous asynchronous operation finished."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes the end of a root element.
    ''' </summary>
    Shared Sub Write_End_Root_Element(ByVal XmlWriter As Xml.XmlTextWriter, _
                                           Optional ByVal Indentation As Xml.Formatting = Xml.Formatting.Indented)

        Try
            XmlWriter.Formatting = Indentation
            XmlWriter.WriteEndElement()
            XmlWriter.Formatting = Not Indentation

        Catch ex As System.Text.EncoderFallbackException
            Dim errormsg As String = "There is a character in the buffer that is a valid XML character but is not valid for the output encoding."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As InvalidOperationException
            Dim errormsg As String = "The XmlTextWriter is closed or An XmlTextWriter method was called before a previous asynchronous operation finished."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes an element.
    ''' </summary>
    Shared Sub Write_Element(ByVal XmlWriter As Xml.XmlTextWriter, _
                                  ByVal StartElement As String, _
                                  ByVal Element As String, _
                                  Optional ByVal Indentation As Xml.Formatting = Xml.Formatting.Indented)

        Try
            XmlWriter.Formatting = Indentation
            XmlWriter.WriteStartElement(StartElement)
            XmlWriter.WriteString(Element)
            XmlWriter.WriteEndElement()
            XmlWriter.Formatting = Not Indentation

        Catch ex As System.Text.EncoderFallbackException
            Dim errormsg As String = "There is a character in the buffer that is a valid XML character but is not valid for the output encoding."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As InvalidOperationException
            Dim errormsg As String = "The XmlTextWriter is closed or An XmlTextWriter method was called before a previous asynchronous operation finished."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes multiple elements.
    ''' </summary>
    Shared Sub Write_Elements(ByVal XmlWriter As Xml.XmlTextWriter, _
                                   ByVal Elements As String(,), _
                                   Optional ByVal Indentation As Xml.Formatting = Xml.Formatting.Indented)

        Try

            XmlWriter.Formatting = Indentation

            For x As Integer = 0 To Elements.GetUpperBound(0)
                XmlWriter.WriteStartElement(Elements(x, 0))
                XmlWriter.WriteString(Elements(x, 1))
                XmlWriter.WriteEndElement()
            Next

            XmlWriter.Formatting = Not Indentation

        Catch ex As System.Text.EncoderFallbackException
            Dim errormsg As String = "There is a character in the buffer that is a valid XML character but is not valid for the output encoding."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As InvalidOperationException
            Dim errormsg As String = "The XmlTextWriter is closed or An XmlTextWriter method was called before a previous asynchronous operation finished."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

    ''' <summary>
    ''' Writes the xml end of file.
    ''' </summary>
    Shared Sub Write_End(ByVal XmlWriter As Xml.XmlTextWriter)

        Try
            XmlWriter.WriteEndDocument()
            XmlWriter.Close()

        Catch ex As ArgumentException
            Dim errormsg As String = "The XML document is invalid."
            Throw New Exception(errormsg & Environment.NewLine & ex.StackTrace)
            ' MessageBox.Show(errormsg)

        Catch ex As Exception
            Throw New Exception(ex.Message & Environment.NewLine & ex.StackTrace)

        End Try

    End Sub

End Class

#End Region
#7775
Gracias chavales

@Shout
Joder, que bueno el PDF, no se como has encontrado algo así xD, con eso ya lo tengo todo resuelto, mil gracias!

@@synthesize
Perdona si te ofendí ayer, pero lo que te dije es un poco cierto... y bueno, se trata de mi madre a la que el gobierno está puteando, así que eso hace que yo esté aún mas susceptible con comentarios negativos.

Un saludo!
#7776
Cita de: Eagle_Alwa en 25 Octubre 2013, 07:06 AMnecesito hacer un convertidor de tallas de calzado.

Yo ahí no veo ningún "Convertidor", asignas valores predefinidos, la aplicación no usa lógica alguna para convertir las unidades, si lo que quieres es predefinir tallas de la forma en la que lo estás haciendo, hazlo en un lugar separado, no me lo hagas diréctamente al seleccionar un item del combobox... muy dinámico eso no es, lo mejor es crear tu propio Type y así ya lo tienes todo resuelto:




Código (vbnet) [Seleccionar]
   Public Class Tallas

       Private _Name As String
       Private _Europa As Double
       Private _USA As Double
       Private _Mexico As Double

       Public Property Name() As String
           Get
               Return _Name
           End Get
           Set(ByVal value As String)
               _Name = value
           End Set
       End Property

       Public Property Europa() As Double
           Get
               Return _Europa
           End Get
           Set(ByVal value As Double)
               _Europa = value
           End Set
       End Property

       Public Property USA() As Double
           Get
               Return _USA
           End Get
           Set(ByVal value As Double)
               _USA = value
           End Set
       End Property

       Public Property Mexico() As Double
           Get
               Return _Mexico
           End Get
           Set(ByVal value As Double)
               _Mexico = value
           End Set
       End Property

   End Class


Código (vbnet) [Seleccionar]

       ' Agrego algunos zapatos con tallas predefinidas
       Dim Tallas As New List(Of Tallas) From { _
           New Tallas With {.Name = "Nombre de zapato 1", .Europa = 39, .USA = 7, .Mexico = 5.5}, _
           New Tallas With {.Name = "Nombre de zapato 2", .Europa = 40, .USA = 7.5, .Mexico = 6} _
       }

   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

       ' Busco un zapato, por su nombre.
       ' Puedes hacer lo mismo comparando el nombre con la propiedad "Combobox.Text"
       Dim Zapato As Tallas = Tallas.Find(Function(x) x.Name = "Nombre de zapato 1")

       ' Muestro los datos que quiero de este zapato encontrado...
       MsgBox(String.Format("Nombre: {1}{0}Talla Europa: {2}{0}Talla USA: {3}{0}Talla Mexico: {4}", _
                            Environment.NewLine, _
                            Zapato.Name, Zapato.Europa, Zapato.USA, Zapato.Mexico))

   End Sub


No soy programador de C#, aqui tienes el código convertido pero no se si funcionará:

Código (csharp) [Seleccionar]

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class Tallas
{

private string _Name;
private double _Europa;
private double _USA;

private double _Mexico;
public string Name {
get { return _Name; }
set { _Name = value; }
}

public double Europa {
get { return _Europa; }
set { _Europa = value; }
}

public double USA {
get { return _USA; }
set { _USA = value; }
}

public double Mexico {
get { return _Mexico; }
set { _Mexico = value; }
}

}

//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================


Código (csharp) [Seleccionar]


private void Form1_Load(object sender, EventArgs e)
{
// Agrego algunos zapatos con tallas predefinidas
List<Tallas> Tallas = new List<Tallas> {
new Tallas {
Name = "Nombre de zapato 1",
Europa = 39,
USA = 7,
Mexico = 5.5
},
new Tallas {
Name = "Nombre de zapato 2",
Europa = 40,
USA = 7.5,
Mexico = 6
}
};

// Busco un zapato, por su nombre.
// Puedes hacer lo mismo comparando el nombre con la propiedad "Combobox.Text"
Tallas Zapato = Tallas.Find(x => x.Name == "Nombre de zapato 1");

// Muestro los datos que quiero de este zapato encontrado...
Interaction.MsgBox(string.Format("Nombre: {1}{0}Talla Europa: {2}{0}Talla USA: {3}{0}Talla Mexico: {4}", Environment.NewLine, Zapato.Name, Zapato.Europa, Zapato.USA, Zapato.Mexico));

}

//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================






Cita de: El Benjo en 25 Octubre 2013, 08:10 AMOtra cosa, espero que al ejecutar la aplicación estés quitando los comentarios, porque si no es así no sé cómo esperas que la propiedad Text cambie. ¬¬

Yo también lo pensé xDDD
#7777
Si, y te lo he pedido con respeto, como comprenderás responderme 3 veces para criticar no es responder, es un poco Troll, no me interesa involucrarme en discusiones o en si el mundo es así o es asá, solo necesito ayuda para encontrar los tests, eso es lo único que me importa de esta y futuras conversaciones en este hilo.

Un saludo.
#7778
@ @synthesize

Lo sigues pintando todo muy bonito...parece que vivas en otro mundo (no lo digo como ofensa)

Aqui hay personas de 50 años y más, si, pero desde pequeños han estado familiarizados con la tecnologia, creo que olvidas ese dato tan importante, parece mentira, ¿es que no conoces a ninguna persona mayor que no tiene ni idea de ordenadores y por mas que le expliques no lo entiende?, que te lo diga cualquier familia numerosa...

CitarY si no hay dinero para pagar multas... haberlo pensado antes de cometer infracciones

Eso es complétamente irrelevante, no tiene nada que ver que te quiten una cosa, con tener que aprender otra (INFORMÁTICA) la cual NO TIENE NADA QUE VER para volver a examinarte del carnet de CONDUCIR.

Cita de: @synthesize en 24 Octubre 2013, 18:38 PMSobre tener ordenador, hay muchos sitios donde acceder a un ordenador (Bibliotecas públicas, cybercafés, vecinos, amigos (amigos los cuales seguro que se ofrecen a explicarte como funciona todo)) etc.

Esta persona consume su tiempo trabajando casi todo el dia, tiene amigos/as de su edad (no son informáticos tampoco ni tienen idea mucha de PC's, como suele ser habitual en la vida real con las personas de 50-60 años), y esta persona no tiene tiempo para mucho, pero aunque lo tuviera, no podría aprender bien, pues ha ido a cibercafés pero los empleados son más patanes manejando un ordenador que una persona de 90 años, así que no le han servido de ayuda para hacer nada.

Y bueno, porfavor, cada uno que piense lo que quiera, te pido que dejes la conversación aqui.

Saludos!
#7779
¿Alguna ayuda más, porfavor?.

Solo busco una página web de Tests de conducir donde salgan todas las preguntas en una página (no 1 pregunta por página) y que no haya que darle a ningún botón tipo "Corregir" para mostrar las respuestas.
#7780
Con este código podemos heredar un TextBox y averiguar la opción que ha elegido el usuario en el CMT por defecto de Windows.

El código original no es mio, pero lo he adaptado apra que funcione corréctamente la opción "Cut", y le he añadido la constande de "Delete".

Modo de empleo:

Código (vbnet) [Seleccionar]
    Private Sub TextBox1_OnTextCommand(sender As Object, e As MyTextBox.ContextCommandEventArgs) _
    Handles MyTextBox1.OnCut, MyTextBox1.OnPaste, MyTextBox1.OnCopy, MyTextBox1.OnDelete

        MessageBox.Show("Activated " & e.Command.ToString())

    End Sub


Código (vbnet) [Seleccionar]
Class MyTextBox : Inherits TextBox

    Private Last_Command As ContextCommands = Nothing

    Private WithEvents CopyOrCut_Timer As New Timer _
            With {.Interval = 5, .Enabled = False}

    Public Enum ContextCommands
        WM_CUT = &H300
        WM_COPY = &H301
        WM_PASTE = &H302
        WM_DELETE = &H303
    End Enum

    Public Class ContextCommandEventArgs
        Inherits EventArgs
        Public Property Command As ContextCommands
    End Class

    Event OnCut(sender As Object, e As ContextCommandEventArgs)
    Event OnCopy(sender As Object, e As ContextCommandEventArgs)
    Event OnPaste(sender As Object, e As ContextCommandEventArgs)
    Event OnDelete(sender As Object, e As ContextCommandEventArgs)

    Protected Overrides Sub WndProc(ByRef m As Message)

        MyBase.WndProc(m)

        Select Case m.Msg

            Case ContextCommands.WM_COPY
                Last_Command = ContextCommands.WM_COPY
                CopyOrCut_Timer.Enabled = True

            Case ContextCommands.WM_CUT
                Last_Command = ContextCommands.WM_CUT

            Case ContextCommands.WM_PASTE
                RaiseEvent OnPaste(Me, New ContextCommandEventArgs() _
                                       With {.Command = ContextCommands.WM_PASTE})

            Case ContextCommands.WM_DELETE
                RaiseEvent OnDelete(Me, New ContextCommandEventArgs() _
                                        With {.Command = ContextCommands.WM_DELETE})

        End Select

    End Sub

    Private Sub Cut_Timer_Tick(sender As Object, e As EventArgs) _
    Handles CopyOrCut_Timer.Tick

        sender.enabled = False

        Select Case Last_Command

            Case ContextCommands.WM_COPY
                RaiseEvent OnCopy(Me, New ContextCommandEventArgs() _
                                      With {.Command = ContextCommands.WM_COPY})

            Case ContextCommands.WM_CUT
                RaiseEvent OnCut(Me, New ContextCommandEventArgs() _
                                     With {.Command = ContextCommands.WM_CUT})

        End Select

        Last_Command = Nothing

    End Sub

End Class