|
Mostrar Mensajes
|
Páginas: [1] 2 3
|
3
|
Programación / Programación Visual Basic / Generar matriz de bingo
|
en: 28 Junio 2014, 21:19 pm
|
Hola tengo un sistema de bingo es el de 75 Bolillas El Bingo a 75 bolas se juega con cartones que tienen una cuadrícula de 5 filas y 5 columnas. Cada fila tiene 5 números y no hay casillas en blanco como en el bingo de 90 bolas. Los números se reparten de la siguiente forma: http://snag.gy/dvzzh.jpgLa primera columna contiene números del 1 al 15, la segunda, del 16 al 30, la tercera del 31 al 45, la cuarta del 46 al 60, y la quinta del 61 al 75. El primero que complete los 25 aciertos gana el premio. Ejemplo de algunos cartones que yo genere y me han funcionado perfectamente. http://snag.gy/ZygAU.jpgBueno el problema que tengo es quiero Generar la matriz de los cartones pero que SOLO AYA UN GANADOR SIEMPRE con 25 aciertos Por que con los numero que yo genero a VECES hay mas de 1 ganador, el problema surge cuando el premio no es en EFECTIVO, por ejemplo si es un auto no puede ser divisible.
|
|
|
4
|
Programación / .NET (C#, VB.NET, ASP) / Enviar y Recibir SMS desde la PC con vb.NET
|
en: 1 Mayo 2013, 18:02 pm
|
Tengo conectado el celular por medio de USB utilizo el puerto COM19 para enviar el SMS con este código. Ahora como hago para leer lo recibido en el Celular Imports System.IO.Ports Imports System.Threading Public Class Form1 Sub enviarSMS(ByVal numero As String, ByVal mensaje As String, ByVal puerto As String) Dim serialport As IO.Ports.SerialPort Try serialport = New IO.Ports.SerialPort With serialport .PortName = puerto ' Puerto de comunicaciones COM1, COM2... .BaudRate = 9600 ' velocidad del puerto .Parity = Parity.None ' Paridad .StopBits = StopBits.One ' Bit de para .DataBits = 8 ' Bits de datos If .IsOpen = False Then ' Si el puerto no esta abierto .Open() ' Abrir el puerto End If .Write("ATZ0" & vbCr) .WriteLine("AT+CMGF=1" & vbCr) ' Configurando envio de SMS modo texto Thread.Sleep(1000) ' Esperar 1 segundo .Write("AT+CMGS=" & Chr(34) & numero & Chr(34) & vbCr) ' Numero al que se envia el SMS .Write(mensaje & Chr(26) & vbCr) Thread.Sleep(1000) ' Esperar 1 segundo .Close() MsgBox("Mensaje enviado") End With Catch Ex As IO.IOException Console.WriteLine(Ex.Message) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click enviarSMS("+595971888222", "Mensaje de prueba", "COM19") End Sub End Class
|
|
|
6
|
Programación / .NET (C#, VB.NET, ASP) / Re: Recuperar imagen de BD cargar en Imagelist y mostrar en ListView
|
en: 11 Agosto 2012, 03:40 am
|
Ya pille cual es el error seba el ejemplo que me pasaste acá para guardar el contenido del picturebox sin tener el path: Sub xSave() '-------------------ESTE ES EL PROBLEMA------------------------------------------------------- Dim xStream As New MemoryStream PictureBox1.Image.Save(xStream, System.Drawing.Imaging.ImageFormat.Jpeg) Dim breader As New BinaryReader(xStream) Dim imgbuffer(xStream.Length) As Byte breader.Read(imgbuffer, 0, xStream.Length) xStream.Close() '---------------------------------------------------------------------------------------------------- strSQL = "INSERT INTO juegos (titulo,imagen) VALUES (@titulo,@imagen)" strComando.CommandText = strSQL strComando.Connection = strConexion strComando.Parameters.AddWithValue("@titulo", txtTitulo.Text) strComando.Parameters.AddWithValue("@imagen", imgbuffer) strComando.ExecuteNonQuery() strComando.Dispose() MsgBox("Saved") End Sub
Creo que guarda mal el archivo y al querer abrir ahi se genera el error de este: ImageList1.Images.Add(dtEmp.Rows(i)("id").ToString(), New Bitmap(img_stream))
Ahora si guardo de esta forma funciona de lujo. Dim fsreader As New FileStream("c:\xxx\4zm.jpg", FileMode.Open, FileAccess.Read) Dim breader As New BinaryReader(fsreader) Dim imgbuffer(fsreader.Length) As Byte breader.Read(imgbuffer, 0, fsreader.Length) fsreader.Close()
|
|
|
9
|
Programación / .NET (C#, VB.NET, ASP) / Recuperar imagen de BD cargar en Imagelist y mostrar en ListView
|
en: 10 Agosto 2012, 22:02 pm
|
Tengo este código para recuperar imágenes de una bd access. Sub RECUPERAR() ImageList1 = New ImageList ImageList1.ImageSize = New Size(100, 100) ImageList1.ColorDepth = ColorDepth.Depth32Bit LF.LargeImageList = ImageList1 LF.Items.Clear() strSQL = "SELECT * FROM juegos" Dim daEmp As New OleDbDataAdapter(strSQL, strConexion) Dim dtEmp As New DataTable daEmp.Fill(dtEmp) For i = 0 To dtEmp.Rows.Count - 1 Dim img_buffer As Byte() img_buffer = DirectCast(dtEmp.Rows(i)("imagen"), Byte()) Dim img_stream As New MemoryStream(img_buffer, True) img_stream.Write(img_buffer, 0, img_buffer.Length) ImageList1.Images.Add(dtEmp.Rows(i)("id").ToString(), New Bitmap(img_stream)) img_stream.Close() Dim item As New ListViewItem(Strings.Left(dtEmp.Rows(i)("titulo").ToString, xTitulo)) item.SubItems.Add(dtEmp.Rows(i)("plataforma").ToString) item.ImageKey = dtEmp.Rows(i)("id").ToString LF.Items.Add(item) Next i End Sub
Pero me tira este error:
|
|
|
10
|
Programación / .NET (C#, VB.NET, ASP) / Guardar imagen sin tener ruta de archivo en una base datos.
|
en: 10 Agosto 2012, 17:10 pm
|
Utilizo este método para guardar una imagen una base datos access. me guarda perfectamente. Dim fsreader As New FileStream("c:\carpeta\foto1.jpg", FileMode.Open, FileAccess.Read) Dim breader As New BinaryReader(fsreader) Dim imgbuffer(fsreader.Length) As Byte breader.Read(imgbuffer, 0, fsreader.Length) fsreader.Close() 'closes the current stream and releases any resources strSQL = "INSERT INTO juegos (titulo,imagen) values (@titulo,@imagen)" strComando.CommandText = strSQL strComando.Connection = strConexion strComando.Parameters.AddWithValue("@titulo", "nuevo metodo") strComando.Parameters.AddWithValue("@imagen", imgbuffer) strComando.ExecuteNonQuery() strComando.Dispose() MsgBox("Saved")
Pero ahora surgió un problemita. tengo un PictureBox en donde le pego el contenido del Clipboard. If Clipboard.GetDataObject.GetDataPresent("Bitmap") Then PictureBox1.Image = CType(Clipboard.GetDataObject.GetData("Bitmap"), Bitmap) End If
y no se como decirle aca en que ruta esta el archivo por que no esta en el disco. Dim fsreader As New FileStream("el-problema-esta-aca-que-poner", FileMode.Open, FileAccess.Read)
|
|
|
|
|
|
|