• Domingo 19 de Mayo de 2024, 01:23

Autor Tema:  Pasar de VC# a VB  (Leído 2215 veces)

Meta

  • Miembro MUY activo
  • ***
  • Mensajes: 140
    • Ver Perfil
Pasar de VC# a VB
« en: Lunes 22 de Diciembre de 2008, 05:36 »
0
Hola:

Hace tiempo hice un manual sobre Visual C# con PIC 16F84A, de tanta demanda estoy con ganas de pasarlo a Visual Basic 2008 Express. No se nada de este lenguaje y me gustaría colaboración de convertir el código que ya tengo hecho de VC# a VB .net.

El manual es este de abajo, pero quiero hacerlo en un PDF a parte.
http://electronicapic.iespana.es/manual/picrs232.pdf

Puedes descargar el código fuente completo de Visual C# para que lo vean y si pueden pasarlo a Visual Basic 2008.
http://www.pic16f84a.org/index.php?opti ... &Itemid=59
Contraseña: D.P.E.

El que quiera colaborar y aparecer su e-mail, web o demás información para ponerlo al final del manual. Me envías el archivo ya con el código fuente completo en Visual Basic 2008 Express y sus comentarios explicado en las líneas de código al e-mail metacontaARROBAgmail.com

Un cordial saludo.

Sagma

  • Miembro MUY activo
  • ***
  • Mensajes: 390
  • Nacionalidad: bo
    • Ver Perfil
Re: Pasar de VC# a VB
« Respuesta #1 en: Lunes 22 de Diciembre de 2008, 13:40 »
0
que tal, yo ocupo esta pagina para pasar de C# a VBnet, el codigo, pero la verdad no se si funcionara para el VB 2008.

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Suerte.  :good:

Feliz Navidad y Prospero Año Nuevo.
Sagma

Meta

  • Miembro MUY activo
  • ***
  • Mensajes: 140
    • Ver Perfil
Re: Pasar de VC# a VB
« Respuesta #2 en: Lunes 22 de Diciembre de 2008, 23:06 »
0
Lo se, me olvidé de actualizar el tema aquí.

Hola:

Hace tiempo hice un manual sobre Visual C# con PIC 16F84A, de tanta demanda estoy con ganas de pasarlo a Visual Basic 2008 Express. No se nada de este lenguaje y me gustaría colaboración de convertir el código que ya tengo hecho de VC# a VB .net.

El manual es este de abajo, pero quiero hacerlo en un PDF a parte.
http://electronicapic.iespana.es/manual/picrs232.pdf

Puedes descargar el código fuente completo de Visual C# para que lo vean y si pueden pasarlo a Visual Basic 2008.
http://www.pic16f84a.org/index.php?opti ... &Itemid=59
Contraseña: D.P.E.

El que quiera colaborar y aparecer su e-mail, web o demás información para ponerlo al final del manual. Me envías el archivo ya con el código fuente completo en Visual Basic 2008 Express y sus comentarios explicado en las líneas de código al e-mail metacontaARROBAgmail.com

Un cordial saludo.

EDITO:
He intentado hacer el código de C# a VB en esta web http://www.developerfusion.com/tools/co ... arp-to-vb/
Código: Text
  1.  
  2. El código en Form1.vb puse:
  3. Imports System
  4. Imports System.Collections.Generic
  5. Imports System.ComponentModel
  6. Imports System.Data
  7. Imports System.Drawing
  8. Imports System.Linq
  9. Imports System.Text
  10. Imports System.Windows.Forms
  11. Imports System.IO.Ports
  12.  
  13. Namespace PicRS232
  14.     Partial Public Class Form1_Principal
  15.         Inherits Form
  16.         ' Utilizaremos un string como buffer de recepcion
  17.         Private Recibidos As String
  18.         Public Sub New()
  19.             InitializeComponent()
  20.             ' Abrir puerto mientra se ejecute la aplicación
  21.             If Not serialPort1.IsOpen Then
  22.                 Try
  23.                     serialPort1.Open()
  24.                 Catch ex As System.Exception
  25.                     MessageBox.Show(ex.ToString())
  26.                 End Try
  27.             End If
  28.             ' Ejecutar la funcion Recepcion por disparo del Evento 'DataReived'
  29.             AddHandler serialPort1.DataReceived, AddressOf Recepcion
  30.         End Sub
  31.         ' Al recibir los datos
  32.         Private Sub Recepcion(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs)
  33.             ' Acumular los carácteres recibidos a nuestro 'buffer' (string)
  34.             Recibidos += serialPort1.ReadExisting()
  35.             ' Invocar o llamar al proceso de tramas
  36.             Me.Invoke(New EventHandler(Actualizar))
  37.         End Sub
  38.         ' Procesar los datos recibidos en el buffer y extraer tramas completas
  39.         Private Sub Actualizar(ByVal s As Object, ByVal e As EventArgs)
  40.             ' Asignar el valor de la trama al textBox
  41.             textBox_visualizar_mensaje.Text = Recibidos
  42.         End Sub
  43.         Private Sub button_t_Click(ByVal sender As Object, ByVal e As EventArgs)
  44.             Dim mBuffer As Byte() = New Byte(0) {}
  45.             mBuffer(0) = &H74
  46.             'ASCII letra "t".
  47.             serialPort1.Write(mBuffer, 0, mBuffer.Length)
  48.         End Sub
  49.  
  50.         Private Sub button_b_Click(ByVal sender As Object, ByVal e As EventArgs)
  51.             Dim miBuffer As Byte() = New Byte(0) {}
  52.             miBuffer(0) = &H62
  53.             'ASCII letra "b".
  54.             serialPort1.Write(miBuffer, 0, miBuffer.Length)
  55.         End Sub
  56.  
  57.         Private Sub button_a_Click(ByVal sender As Object, ByVal e As EventArgs)
  58.             Dim mBuffer As Byte() = New Byte(0) {}
  59.             mBuffer(0) = &H61
  60.             'ASCII letra "a".
  61.             serialPort1.Write(mBuffer, 0, mBuffer.Length)
  62.         End Sub
  63.  
  64.         Private Sub button_l_Click(ByVal sender As Object, ByVal e As EventArgs)
  65.             Dim mBuffer As Byte() = New Byte(0) {}
  66.             mBuffer(0) = &H6C
  67.             'ASCII letra "l".
  68.             serialPort1.Write(mBuffer, 0, mBuffer.Length)
  69.         End Sub
  70.  
  71.         Private Sub button_Espacio_Click(ByVal sender As Object, ByVal e As EventArgs)
  72.             Dim mBuffer As Byte() = New Byte(0) {}
  73.             mBuffer(0) = &H20
  74.             'ASCII letra "Espacio".
  75.             serialPort1.Write(mBuffer, 0, mBuffer.Length)
  76.         End Sub
  77.  
  78.         Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
  79.             statusStrip1.Items(0).Text = DateTime.Now.ToLongTimeString()
  80.         End Sub
  81.     End Class
  82. End Namespace
  83.  




Ahora en Form1.Designer.vb puse:
Código: Text
  1.  
  2. Namespace PicRS232
  3.     Partial Class Form1_Principal
  4.         ''' <summary>
  5.         ''' Variable del diseñador requerida.
  6.         ''' </summary>
  7.         Private components As System.ComponentModel.IContainer = Nothing
  8.  
  9.         ''' <summary>
  10.         ''' Limpiar los recursos que se estén utilizando.
  11.         ''' </summary>
  12.         ''' <param name="disposing">true si los recursos administrados se deben eliminar; false en caso contrario, false.</param>
  13.         Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  14.             If disposing AndAlso (components IsNot Nothing) Then
  15.                 components.Dispose()
  16.             End If
  17.             MyBase.Dispose(disposing)
  18.         End Sub
  19.  
  20. #Region "Código generado por el Diseñador de Windows Forms"
  21.  
  22.         ''' <summary>
  23.         ''' Método necesario para admitir el Diseñador. No se puede modificar
  24.         ''' el contenido del método con el editor de código.
  25.         ''' </summary>
  26.         Private Sub InitializeComponent()
  27.             Me.components = New System.ComponentModel.Container()
  28.             Me.button_t = New System.Windows.Forms.Button()
  29.             Me.button_b = New System.Windows.Forms.Button()
  30.             Me.button_a = New System.Windows.Forms.Button()
  31.             Me.button_l = New System.Windows.Forms.Button()
  32.             Me.button_Espacio = New System.Windows.Forms.Button()
  33.             Me.serialPort1 = New System.IO.Ports.SerialPort(Me.components)
  34.             Me.statusStrip1 = New System.Windows.Forms.StatusStrip()
  35.             Me.textBox_visualizar_mensaje = New System.Windows.Forms.TextBox()
  36.             Me.label_mensaje_pic = New System.Windows.Forms.Label()
  37.             Me.timer1 = New System.Windows.Forms.Timer(Me.components)
  38.             Me.toolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
  39.             Me.statusStrip1.SuspendLayout()
  40.             Me.SuspendLayout()
  41.             '
  42.             ' button_t
  43.             '
  44.             Me.button_t.Location = New System.Drawing.Point(109, 38)
  45.             Me.button_t.Name = "button_t"
  46.             Me.button_t.Size = New System.Drawing.Size(75, 23)
  47.             Me.button_t.TabIndex = 0
  48.             Me.button_t.Text = "t"
  49.             Me.button_t.UseVisualStyleBackColor = True
  50.             AddHandler Me.button_t.Click, AddressOf Me.button_t_Click
  51.             '
  52.             ' button_b
  53.             '
  54.             Me.button_b.Location = New System.Drawing.Point(109, 67)
  55.             Me.button_b.Name = "button_b"
  56.             Me.button_b.Size = New System.Drawing.Size(75, 23)
  57.             Me.button_b.TabIndex = 1
  58.             Me.button_b.Text = "b"
  59.             Me.button_b.UseVisualStyleBackColor = True
  60.             AddHandler Me.button_b.Click, AddressOf Me.button_b_Click
  61.             '
  62.             ' button_a
  63.             '
  64.             Me.button_a.Location = New System.Drawing.Point(28, 67)
  65.             Me.button_a.Name = "button_a"
  66.             Me.button_a.Size = New System.Drawing.Size(75, 23)
  67.             Me.button_a.TabIndex = 2
  68.             Me.button_a.Text = "a"
  69.             Me.button_a.UseVisualStyleBackColor = True
  70.             AddHandler Me.button_a.Click, AddressOf Me.button_a_Click
  71.             '
  72.             ' button_l
  73.             '
  74.             Me.button_l.Location = New System.Drawing.Point(190, 67)
  75.             Me.button_l.Name = "button_l"
  76.             Me.button_l.Size = New System.Drawing.Size(75, 23)
  77.             Me.button_l.TabIndex = 3
  78.             Me.button_l.Text = "l"
  79.             Me.button_l.UseVisualStyleBackColor = True
  80.             AddHandler Me.button_l.Click, AddressOf Me.button_l_Click
  81.             '
  82.             ' button_Espacio
  83.             '
  84.             Me.button_Espacio.BackColor = System.Drawing.Color.FromArgb(CInt(CByte((255))), CInt(CByte((128))), CInt(CByte((0))))
  85.             Me.button_Espacio.Location = New System.Drawing.Point(190, 96)
  86.             Me.button_Espacio.Name = "button_Espacio"
  87.             Me.button_Espacio.Size = New System.Drawing.Size(75, 23)
  88.             Me.button_Espacio.TabIndex = 4
  89.             Me.button_Espacio.Text = "Espacio"
  90.             Me.button_Espacio.UseVisualStyleBackColor = False
  91.             AddHandler Me.button_Espacio.Click, AddressOf Me.button_Espacio_Click
  92.             '
  93.             ' serialPort1
  94.             '
  95.             Me.serialPort1.StopBits = System.IO.Ports.StopBits.Two
  96.             '
  97.             ' statusStrip1
  98.             '
  99.             Me.statusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripStatusLabel1})
  100.             Me.statusStrip1.Location = New System.Drawing.Point(0, 244)
  101.             Me.statusStrip1.Name = "statusStrip1"
  102.             Me.statusStrip1.Size = New System.Drawing.Size(292, 22)
  103.             Me.statusStrip1.TabIndex = 7
  104.             Me.statusStrip1.Text = "statusStrip1"
  105.             '
  106.             ' textBox_visualizar_mensaje
  107.             '
  108.             Me.textBox_visualizar_mensaje.Anchor = DirectCast(((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles)
  109.             Me.textBox_visualizar_mensaje.Location = New System.Drawing.Point(0, 162)
  110.             Me.textBox_visualizar_mensaje.Multiline = True
  111.             Me.textBox_visualizar_mensaje.Name = "textBox_visualizar_mensaje"
  112.             Me.textBox_visualizar_mensaje.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
  113.             Me.textBox_visualizar_mensaje.Size = New System.Drawing.Size(292, 82)
  114.             Me.textBox_visualizar_mensaje.TabIndex = 6
  115.             '
  116.             ' label_mensaje_pic
  117.             '
  118.             Me.label_mensaje_pic.AutoSize = True
  119.             Me.label_mensaje_pic.Location = New System.Drawing.Point(25, 146)
  120.             Me.label_mensaje_pic.Name = "label_mensaje_pic"
  121.             Me.label_mensaje_pic.Size = New System.Drawing.Size(110, 13)
  122.             Me.label_mensaje_pic.TabIndex = 5
  123.             Me.label_mensaje_pic.Text = "Mensaje desde el PIC"
  124.             '
  125.             ' timer1
  126.             '
  127.             Me.timer1.Enabled = True
  128.             Me.timer1.Interval = 1000
  129.             AddHandler Me.timer1.Tick, AddressOf Me.timer1_Tick
  130.             '
  131.             ' toolStripStatusLabel1
  132.             '
  133.             Me.toolStripStatusLabel1.Name = "toolStripStatusLabel1"
  134.             Me.toolStripStatusLabel1.Size = New System.Drawing.Size(53, 17)
  135.             Me.toolStripStatusLabel1.Text = "hh:mmTongue Tieds"
  136.             '
  137.             ' Form1_Principal
  138.             '
  139.             Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0F, 13.0F)
  140.             Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
  141.             Me.ClientSize = New System.Drawing.Size(292, 266)
  142.             Me.Controls.Add(Me.label_mensaje_pic)
  143.             Me.Controls.Add(Me.textBox_visualizar_mensaje)
  144.             Me.Controls.Add(Me.statusStrip1)
  145.             Me.Controls.Add(Me.button_Espacio)
  146.             Me.Controls.Add(Me.button_l)
  147.             Me.Controls.Add(Me.button_a)
  148.             Me.Controls.Add(Me.button_b)
  149.             Me.Controls.Add(Me.button_t)
  150.             Me.Name = "Form1_Principal"
  151.             Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  152.             Me.Text = "PicRS232"
  153.             Me.statusStrip1.ResumeLayout(False)
  154.             Me.statusStrip1.PerformLayout()
  155.             Me.ResumeLayout(False)
  156.             Me.PerformLayout()
  157.  
  158.         End Sub
  159.  
  160. #End Region
  161.  
  162.         Private button_t As System.Windows.Forms.Button
  163.         Private button_b As System.Windows.Forms.Button
  164.         Private button_a As System.Windows.Forms.Button
  165.         Private button_l As System.Windows.Forms.Button
  166.         Private button_Espacio As System.Windows.Forms.Button
  167.         Private serialPort1 As System.IO.Ports.SerialPort
  168.         Private statusStrip1 As System.Windows.Forms.StatusStrip
  169.         Private textBox_visualizar_mensaje As System.Windows.Forms.TextBox
  170.         Private label_mensaje_pic As System.Windows.Forms.Label
  171.         Private timer1 As System.Windows.Forms.Timer
  172.         Private toolStripStatusLabel1 As System.Windows.Forms.ToolStripStatusLabel
  173.     End Class
  174.  
  175.  
  176. End Namespace
  177.  

Al ejecutar me sale error:
Error    1    El delegado 'System.EventHandler' requiere una expresión 'AddressOf' o una expresión lambda como único argumento de su constructor.    C:Documents and SettingsHunterMis documentosVisual Studio 2008Projectsprueba1prueba1Form1.vb    34    40    prueba1

Otro error.
Error    2    'Form1' no es un miembro de 'prueba1'.    C:Documents and SettingsHunterMis documentosVisual Studio 2008Projectsprueba1prueba1My ProjectApplication.Designer.vb    35    27    prueba1

Código: Text
  1. '------------------------------------------------------------------------------
  2. ' <auto-generated>
  3. '     This code was generated by a tool.
  4. '     Runtime Version:2.0.50727.3053
  5. '
  6. '     Changes to this file may cause incorrect behavior and will be lost if
  7. '     the code is regenerated.
  8. ' </auto-generated>
  9. '------------------------------------------------------------------------------
  10.  
  11. Option Strict On
  12. Option Explicit On
  13.  
  14.  
  15. Namespace My
  16.    
  17.     'NOTE: This file is auto-generated; do not modify it directly.  To make changes,
  18.     ' or if you encounter build errors in this file, go to the Project Designer
  19.     ' (go to Project Properties or double-click the My Project node in
  20.     ' Solution Explorer), and make changes on the Application tab.
  21.     '
  22.     Partial Friend Class MyApplication
  23.        
  24.         <Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
  25.         Public Sub New()
  26.             MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
  27.             Me.IsSingleInstance = false
  28.             Me.EnableVisualStyles = true
  29.             Me.SaveMySettingsOnExit = true
  30.             Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
  31.         End Sub
  32.        
  33.         <Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
  34.         Protected Overrides Sub OnCreateMainForm()
  35.             Me.MainForm = Global.PicRS232.Form1
  36.         End Sub
  37.     End Class
  38. End Namespace
  39.  

Necesito ayuda.