domingo, 18 de marzo de 2012

Visual studio 2010 " DAR MOVIMIENTO MANUAL A UNA IMAGEN"

Para ello utilizaremos
4 BUTTON que daran la direccion deseada de la imagen
1 PICTUREBOX




Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Top = PictureBox1.Top - 30
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PictureBox1.Top = PictureBox1.Top + 30
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PictureBox1.Left = PictureBox1.Left + 30
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
PictureBox1.Left = PictureBox1.Left - 30
End Sub
End Class

Visual studio 2010 " DAR MOVIMIENTO A UNA IMAGEN"

para ello utilizaremos
1 PICTUREBOX
1 TMER


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim x As String
x = PictureBox1.Left
x = x + 100
PictureBox1.Left = x
End Sub
End Class



Visual Studio 2010 "Button que no se deja atrapar "



Para ello iremos ala sentencia MOUSEMOVE

Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
Dim r As New Random()
Dim x As Integer = CInt(Me.ClientRectangle.Right * r.NextDouble()) - 30
Dim y As Integer = CInt(Me.ClientRectangle.Bottom * r.NextDouble()) - 10
Button1.Location = New Point(x, y)
End Sub

martes, 13 de marzo de 2012

Visual studio 2010 " CREAR UN INVENTARIO"

Crear un inventario

Para ello crearemos:
11; Buttom
5; listbox
5;textbox
2; datetimepicker

ESTE PROGRAMA CONSISTE EN DIGITAR EN LOS TEXTBOX EL CODIGO ,DISTIBUCION DEL PRODUCTO y cada ves que lo digitememos oprimimos  DT para guardarlo en el listbox respectivo si queremos borrar oprimimos en el buttom


CUANDO DIGITEMOS  ,CANTIDAD"producto" Y  PRECIO UNITARIO"precio del producto"/ DAMOS EN EL BUTTON DE CANTIDAD*PRECIO para que nos de el resultado en el textbox de precio total  despues procedemos a darle DT para subirlo al listbox5 .


cuando tenga muchos TOTALES le damos en el buttom CALCULAR ara la suma de todos los numeros que se encuentren en el listbox5 el resultado lo mostrara en un msgbox.


Public Class Form1

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If ListBox5.SelectedIndex <> -1 Then

ListBox5.Items.RemoveAt(ListBox5.SelectedIndex)
Label5.Text = ListBox5.Items.Count & " "
Else

End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox2.Items.Add(TextBox2.Text)
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ListBox3.Items.Add(TextBox3.Text)
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox4.Items.Add(TextBox4.Text)
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
ListBox5.Items.Add(TextBox5.Text)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If ListBox1.SelectedIndex <> -1 Then

ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
Label1.Text = ListBox1.Items.Count & " "
Else

End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If ListBox2.SelectedIndex <> -1 Then

ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Label2.Text = ListBox2.Items.Count & " "
Else

End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If ListBox3.SelectedIndex <> -1 Then

ListBox3.Items.RemoveAt(ListBox3.SelectedIndex)
Label3.Text = ListBox3.Items.Count & " "
Else

End If
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If ListBox4.SelectedIndex <> -1 Then

ListBox4.Items.RemoveAt(ListBox4.SelectedIndex)
Label4.Text = ListBox4.Items.Count & " "
Else

End If
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
TextBox5.Text = Val(TextBox3.Text) * Val(TextBox4.Text)

End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim suma As Integer

For Each elemento In ListBox5.Items

suma += elemento.ToString

Next

MessageBox.Show(suma)



End Sub
End Class


Visual studio 2010"Como pasar de un listbox1 a un listbox2 itemns"

como pasar de un listbox1 a un listbox2 itemns
para ello crearemos:
2; listBox
7 ; Button "respectivamente >>,>,<<,< añadir,eliminar, button"organizar"
1; textbox1
2 ; label "quienes mostraran el numero de items que estén registrados en los listbox"


Public Class Form1
Private Const msgbox_Eliminar As String = "Para eliminar un dato, debe seleccionarlo previamente"
Private Const msgbox_Pasar_Dato As String = "Para pasar un dato, debe seleccionarlo previamente"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With ListBox1
.Items.Add("Footbal")
.Items.Add("Tenis")
.Items.Add("Baloncesto")
.Items.Add("Rana")
.Items.Add("Tejo")
.Items.Add("Natación")
.Items.Add("Atletismo")

End With
Label1.Text = ListBox1.Items.Count & " elemento(s)"

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button5.Click

If TextBox1.Text <> "" Then

End If
ListBox1.Items.Add(TextBox1.Text)
Label1.Text = ListBox1.Items.Count & " elemento(s)"
TextBox1.Text = ""

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

If ListBox1.SelectedIndex <> -1 Then

ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
Label1.Text = ListBox1.Items.Count & " elemento(s)"
Else

End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

While ListBox1.Items.Count > 0
ListBox1.SelectedIndex = ListBox1.Items.Count - 1
ListBox2.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End While
Label1.Text = ListBox1.Items.Count & " elemento(s)"
Label2.Text = ListBox2.Items.Count & " elemento(s)"

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

While ListBox2.Items.Count > 0
ListBox2.SelectedIndex = ListBox2.Items.Count - 1
ListBox1.Items.Add(ListBox2.SelectedItem)
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
End While
Label1.Text = ListBox1.Items.Count & " elemento(s)"
Label2.Text = ListBox2.Items.Count & " elemento(s)"

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

If ListBox1.SelectedIndex <> -1 Then

ListBox2.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
Label1.Text = ListBox1.Items.Count & " elemento(s)"
Label2.Text = ListBox2.Items.Count & " elemento(s)"
Else
If ListBox1.Items.Count > 0 Then

End If
End If

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox2.Sorted = True
ListBox2.Sorted = False

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

If ListBox2.SelectedIndex <> -1 Then

ListBox1.Items.Add(ListBox2.SelectedItem)
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Label1.Text = ListBox1.Items.Count & " elemento(s)"
Label2.Text = ListBox2.Items.Count & " elemento(s)"
Else
If ListBox2.Items.Count > 0 Then

End If
End If

End Sub







Visual studio 2010 "Como crear una CONTRASEÑA"

Como crear una contraseña
para ello crearemos:
1; label1
1; textbox1
1; Button1
Dentro del button digitamos.




Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "0" Then "el cero o cualquier numero sera la contraseña correcta"
            Form2.Show()
            Form2.Hide()
        Else : MsgBox("contraseña inavalida")
        End If
    End Sub
End Class

Visual studio 2010" Dar COLOR A UN TEXTO"

 COLORES DE TEXTO


para ello crearemos:
3; label1
1 ;textbox1
6 ;Radiobutton

Public Class Form1

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        TextBox1.BackColor = Color.Blue
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        TextBox1.BackColor = Color.Black
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        TextBox1.BackColor = Color.Bisque
    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        TextBox1.ForeColor = Color.Aquamarine
    End Sub

    Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
        TextBox1.ForeColor = Color.Brown
    End Sub

    Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
        TextBox1.ForeColor = Color.DarkGreen
    End Sub
End Class