|
Mostrar Mensajes
|
Páginas: 1 2 [3] 4 5
|
25
|
Programación / Programación Visual Basic / Re: formatear texto visual basic
|
en: 10 Abril 2008, 03:39 am
|
Hola como estas, mira realice este codigo, cada vez q escribis la palabra "hola" o cualquier otra palabra q despues la podes cambiar, cambia su color a rojo y el resto del texto q escribe el usuario se ponde de color azul; esta comprobacion la realiza cada vez q presionas la tecla Espacio. Espero haberte ayudado. Private Sub Form_Load() RichTextBox1.Text = "(Reverse engineering). La ingeniería inversa es el proceso de descubrir los principios tecnológicos de un dispositivo, objeto o sistema, a través de razonamiento abductivo de su estructura, función y operación." RichTextBox1.SelStart = Len(RichTextBox1.Text) End Sub
Private Sub RichTextBox1_KeyPress(KeyAscii As Integer) If KeyAscii = 32 Then '---> Si presiono la tecla Espacio CambiarColor ' ---> Llama al procedimiento CambiarColor End If End Sub
Public Sub CambiarColor() With RichTextBox1 .SelStart = 0 '---> Comienza desde el principio Do x = .Find("hola", .SelStart, , rtfWholeWord Or rtfMatchCase)'---> Busca la palabra .SelColor = vbRed '---> Establece el color .SelStart = .SelStart + 1 '---> Incrementa en 1 Loop Until x = -1 .SelStart = Len(.Text) '---> Se posiciona al final de todo End With End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer) RichTextBox1.SelColor = vbBlue '---> Tipea de color azul End Sub
Saludos.
|
|
|
27
|
Programación / .NET (C#, VB.NET, ASP) / Re: Cálcular en Vb # 2005 express edition
|
en: 3 Abril 2008, 00:23 am
|
Hola, para dudas de VB.NET esta el subforo, pero bueno te la respondo igual a la pregunta, pienso q queres algo asi: Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click textB4.Text = Val(textB2.Text) + Val(textB3.Text) End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Button1.Text = "Calcular" End Sub End Class
Saludos.
|
|
|
29
|
Programación / Programación Visual Basic / Re: autocompletar en listview
|
en: 25 Marzo 2008, 20:13 pm
|
Hola como estas, lo q yo se es q la busqueda en los lvwSubitem o (valor=1) siempre busca la cadena completa, y en el lvwText o (valor=0), la búsqueda parcial sólo es desde el principio, al codigo de la funcion Autocompletar le agregue un checkbox para comprobar si se quiere realizar la busqueda por nombre. Sub Autocompletar(ListView As ListView, TBox As TextBox) Dim item As ListItem Dim seleccion As Integer
If chkNombre.Value = 0 Then Set item = ListView.FindItem(TBox.Text, 0, , 1) If Not item Is Nothing Then ListView.HideSelection = False item.EnsureVisible item.Selected = True If Not Flag Then seleccion = TBox.SelStart TBox.Text = CStr(item) If Not TBox.Text = vbNullString Then TBox.SelStart = seleccion TBox.SelLength = Len(TBox.Text) - seleccion End If End If Else ListView.HideSelection = True End If Else Set item = ListView.FindItem(TBox.Text, lvwSubItem, , lvwPartial) If Not item Is Nothing Then ListView.HideSelection = False item.EnsureVisible item.Selected = True TBox.SelStart = seleccion TBox.SelLength = Len(TBox.Text) - seleccion Else ListView.HideSelection = True End If End If End Sub
Espero haber ayudado en algo. Saludos
|
|
|
|
|
|
|