|
Mostrar Mensajes
|
Páginas: 1 2 3 [4]
|
35
|
Programación / Programación Visual Basic / Ayuda con un ListBox
|
en: 23 Mayo 2011, 18:37 pm
|
Ante todo que tengan un buen dia, escribo este tema para q me puedan ayudar sobre como puedo agregar un texto a un listbox desde un textbox como por ejemplo este: "hola como estas" pero que me agregue dividido mas o menos asi: hola como estas claro pero en el listbox todo para abajo espero me ayuden gracias de antemano.
|
|
|
36
|
Programación / .NET (C#, VB.NET, ASP) / Re: Error con mi codigo
|
en: 13 Noviembre 2010, 17:17 pm
|
Gracias 43H4FH44H45H4CH49H56H45H es una gran ayuda la tuya pero ahora mi gran problema es que tu codigo me muestra las carpetas que contienen el error como podria implementarlo para que me obie dicho error. Porfavor soy nuevo en esta cituacion espero me entiendan ahi les mando todo el codigo: Imports System.IO Imports System.Text Public Class Form1 Dim a, c, acu
Private Shared Sub add(ByVal g As FileStream, ByVal value As String) Dim f As Byte() = New UTF8Encoding(False).GetBytes(value) g.Write(f, 0, f.Length) End Sub Sub filestren() Try Dim fs As New FileStream(acu, FileMode.Open, FileAccess.Read) Dim datos(1024) As Byte Dim enc As New System.Text.UTF8Encoding Dim texto As New System.Text.StringBuilder
While fs.Read(datos, 0, 1024) > 0 texto.Append(enc.GetString(datos)) RichTextBox1.Text = enc.GetString(datos) End While fs.Close() Catch ex As Exception
End Try End Sub Sub streanreader() Dim a As String = (acu) Try Using f As StreamReader = File.OpenText(a) Dim c As String c = f.ReadLine() While Not c Is Nothing RichTextBox1.Text = c c = f.ReadLine() End While f.Close() End Using Catch ex As Exception
End Try End Sub Sub filestreanescritura() Dim a As String = acu If File.Exists(a) Then File.Delete(a) End If Dim b As FileStream = File.Create(a) add(b, acu1) RichTextBox1.Text = acu1 b.Close() End Sub Sub streanwrite() Dim a As String = (acu) Using b As StreamWriter = File.CreateText(a) b.WriteLine(acu1) RichTextBox1.Text = acu1 b.Close() End Using End Sub
Public Sub LlenarUnidades() Dim Unidades(), Unidad As String Unidades = Directory.GetLogicalDrives For Each Unidad In Unidades ComboBox1.Items.Add(Unidad) Next End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Try If rdbuscar.Checked = True Then a = InputBox("Escriba el nombre del archivo a buscar", "Ingrese Datos") If a = "" Then MsgBox("Cadena vacia") Else My.Forms.buscando.Show() For Each b As String In My.Computer.FileSystem.GetFiles(ComboBox1.Text, FileIO.SearchOption.SearchAllSubDirectories, a) TextBox1.Text = b acu = b If rdbfilestream.Checked = True Then filestren() My.Forms.buscando.Close() Exit For End If If rdbstreamreader.Checked = True Then streanreader() My.Forms.buscando.Close() Exit For End If Next End If End If If rdlistar.Checked = True Then
opc.ShowDialog() TextBox1.Text = opc.FileName acu = opc.FileName If rdbfilestream.Checked = True Then filestren() End If If rdbstreamreader.Checked = True Then streanreader() End If End If 'Catch ex As Exception
'End Try End Sub
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click 'Close() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load opc.Filter = "(*.txt)|*.txt|(*.doc)|*.doc|(*.pdf)|*.pdf|(*.log)|*.log|(*.inf)|*.inf|(*.ini)|*.ini" LlenarUnidades() End Sub Dim acu1 Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged acu1 = InputBox("Escriba el texto a escribir en el archivo seleccionado", "Ingrese Datos ''FileStream''") streanwrite() End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged acu1 = InputBox("Escriba el texto a escribir en el archivo seleccionado", "Ingrese Datos ''StreamReader''") filestreanescritura() End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged RadioButton3.Enabled = True RadioButton4.Enabled = True End Sub
Private Sub rdbfilestream_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbfilestream.CheckedChanged Button1.Enabled = True End Sub
Private Sub rdbstreamreader_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbstreamreader.CheckedChanged Button1.Enabled = True End Sub
Private Sub rdbuscar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbuscar.CheckedChanged rdbfilestream.Enabled = True rdbstreamreader.Enabled = True ComboBox1.Enabled = True End Sub
Private Sub rdlistar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdlistar.CheckedChanged rdbfilestream.Enabled = True rdbstreamreader.Enabled = True ComboBox1.Enabled = False End Sub End Class Espero me ayuden gracias de antemano.
|
|
|
37
|
Programación / .NET (C#, VB.NET, ASP) / Re: Error con mi codigo
|
en: 6 Noviembre 2010, 02:30 am
|
Gracias 43H4FH44H45H4CH49H56H45H y [D4N93R]. Pero no se si me podrian ayudar a implementarlo en el codigo, si pude entenderles pero no se como implementarlo porfavor ayudenme es eso gracias.
|
|
|
|
|
|
|