|
Mostrar Temas
|
Páginas: [1]
|
1
|
Programación / Programación Visual Basic / [DUDA] Hacer frase aleatoria
|
en: 8 Enero 2008, 16:02 pm
|
Buenas,
Quisiera hacer que ene l load del form, apareciesen, cada vez que el exe se carga, una frase aleatoria que yo pondria. No me imagino como deberia aserlo ya que es la 1º vez que hago algo asin :S
Y tambien me gustaria saber comoo hacer para que el user que habr el exe, al darle a un boton, la frase que hay en el text1 se meta en el codigo y se quede hay. No se si esto ultimo es posible epro si no lo fuese pos ya vere como lo podria haer.
Desde ya gracias a todos^^
|
|
|
2
|
Programación / Programación Visual Basic / copiar programa para que se inicie con windows
|
en: 4 Enero 2008, 15:47 pm
|
buenas, pues es aqui mi duda.
Se que para que un programa se inicie con windows a de estar aqui: HKEY_LOCAL_MAC HINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
pero nose como hacer que mediante un comandbutton o lo que sea, al darle se copie hay para iniciar el programa. Alguien es tan amable de decirme o explicarme o indicarme donde se encuentra el com?
desde ya gracias^^
|
|
|
3
|
Programación / Programación Visual Basic / [DUDA] uso de FTP
|
en: 29 Diciembre 2007, 23:25 pm
|
hola,
Quisiera crear un ftp, sencillo y funcional pero nose nada o casi nada sobre winsock y no encuentro tutos Si teneis un tuto sobre winsock os agradeceria dejarais el link o algun tuto sobre ftp.
PD: no encuentro el buscador del foro por eo posteo :S
|
|
|
4
|
Programación / Programación Visual Basic / Colorear letras automaticamente y situacion del cursor
|
en: 29 Diciembre 2007, 21:54 pm
|
Buenas^^ Bien, tengo un programa el cual tiene un Richtextbox con un modulo que lo que hace es colorear letras pero el problema esque las colorea cuando el cursor pincha en la line en la que esta la palabra pero las demas palabras iguales en el resto del texto n las colorea. ¿Como hago para que se coloreen todas al pulsar en el richtexbox en cualquuier linea?(si nesesitan codigo s pidanlo) -------------------------------------------------------------------------------------------------- Esta es otra duda. Tengo un textbox que al pulsar enter lo que tiene dentro se va al rich textbox, que le tengo que añadir al siguiente codigo para que aparte de hacer lo que hace haga que la situacion del cursor sea en el textbox? Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{tab}", True KeyAscii = 0 Rich1 = Rich1.Text & vbCrLf & " mes " & """" & Text2 & """" Text2 = "" End If End Sub Muchas gracias de antemano a todos^^
|
|
|
5
|
Programación / Programación Visual Basic / [DUDA] Como presentar imagen de carga al inicio de una aplicacion
|
en: 7 Diciembre 2007, 16:12 pm
|
buenas, he creado una imagen en la que se muestra el creador y colaboradores de un programilla que estoy realizando, se lo he añadido a un form pero nose como hacer que se cargue al inicio de la aplicacion, y que al cabo del rato, 5 o 10 seg la imagen se desvanezca y aparezca ya el primer form.
Si es posible me gustaria qu e la imagen que se muestra sea lisa, sin mostrar las tipicos contorneo de aplicacion, no se si me explico.
Agradezco la ayuda de antemano^^
PD: perdonad si de esto ya se ha hablado, pero esque no encuntro el boton de buscarr en la web :S
|
|
|
6
|
Programación / Programación Visual Basic / [AYUDA][SOLUCIONADO] Richtextbox no acepta mayusculas
|
en: 6 Diciembre 2007, 15:37 pm
|
buenas. m problema es el siguiente: Tengo un text1, el cual al pulsar enter escribe lo que teiene escrito en el rich textbox, este usa modulo para sobresaltar palabras escritar con colores. Mi problema esque si escribo en el textbox algo en mayusculas y le doy a enter se atasca y no lo envia. Codigos: module: Public currchar Public thisLine Public tstart Public tend Public holdtend Public holdtstart Public TopLine Public foundpos Public commentchar As String Public longvar As String
Public Declare Function LockWindowUpdate Lib "user32" _ (ByVal hwndLock As Long) As Long
Public Function ColorizeWord(Rich1 As RichTextBox, Word As String, color As OLE_COLOR)
Do Until Rich1.GetLineFromChar(tstart) <> thisLine tstart = tstart - 1 If tstart < 0 Then tstart = 0 Exit Do End If Loop
startline = Rich1.GetLineFromChar(Rich1.SelStart) If Rich1.SelLength > 0 Then Exit Function Rich1.Enabled = False
tstart = tstart If tstart = 0 Then tstart = 1 End If
tstart = tstart - Len(Word)
Do nowline = Rich1.GetLineFromChar(Rich1.SelStart) If nowline <> startline Then GoTo endx holdtstart = tstart + Len(Word) commentposx = InStr(holdtstart, Rich1.Text, commentchar, vbTextCompare) If holdtstart < 1 Then holdtstart = 1 End If
tstart = tstart + Len(Word) foundpos = InStr(tstart, Rich1.Text, Word, vbTextCompare) If foundpos > tend Then GoTo endx ''''''''''''''''''''' If foundpos < 1 Then GoTo endx If foundpos < 2 Then sletter = "" Else sletter = Mid(Rich1.Text, foundpos - 1, 1) End If eletter = Mid(Rich1.Text, foundpos + Len(Word), 1) If foundpos > 0 Then If foundpos = 1 Then tstart = tstart - 1 End If
Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) '################################################### If Word = commentchar Then tend = Rich1.SelStart Do Until Rich1.GetLineFromChar(tend) <> thisLine tend = tend + 1 If tend > Len(Rich1.Text) Then tend = Len(Rich1.Text) + 1 Exit Do End If Loop Rich1.SelStart = foundpos - 1 Rich1.SelLength = tend - (foundpos - 1) Rich1.SelColor = color Rich1.SelLength = 0 Rich1.SelStart = currchar Rich1.SelColor = &H0& Exit Function Exit Do End If '''''''''''''''''''''''''''''' If Word = longvar Then tend = Rich1.SelStart Do Until Rich1.GetLineFromChar(tend) <> thisLine tend = tend + 1 If tend > Len(Rich1.Text) Then tend = Len(Rich1.Text) + 1 Exit Do End If Loop
pos = tstart Do foundpos = InStr(pos, Rich1.Text, longvar, vbTextCompare)
For i = foundpos To tend If foundpos < 1 Then Exit For If i = tend Then Exit For Rich1.SelStart = i - 1 Rich1.SelLength = 1 If Rich1.SelText = "" Then Exit For Select Case Asc(Rich1.SelText) Case 48 To 57 Rich1.SelColor = color Case 36 Rich1.SelColor = color Case 97 To 122 Rich1.SelColor = color Case 65 To 90 Rich1.SelColor = color Case 145 Rich1.SelColor = color Case 146 Rich1.SelColor = color Case 143 Rich1.SelColor = color Case 143 Rich1.SelColor = color Case Else Exit For End Select
Next
pos = foundpos + 2 Loop While foundpos > 0
GoTo endx End If
If tstart = 0 Then tstart = 1 End If commentposx = InStr(tstart, Rich1.Text, commentchar, vbTextCompare) If commentposx > 0 Then If Rich1.SelStart > commentposx Then GoTo endx End If
If Len(Word) = 1 Then Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = "" And sletter = "" Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If If eletter = "" And sletter = " " Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If If eletter = " " And sletter = "" Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If If eletter = " " And sletter = " " Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If If eletter = "" And sletter = Chr(10) Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = " " And sletter = Chr(10) Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(10) And sletter = "" Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(10) And sletter = " " Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(10) And sletter = Chr(10) Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(13) And sletter = Chr(10) Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(13) And sletter = "" Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
If eletter = Chr(13) And sletter = " " Then theword = Rich1.SelText originaltext = Rich1.SelText theword = LCase(theword) firstchar = Mid(theword, 1, 1) rest = Mid(theword, 2, Len(theword)) Rich1.SelText = firstchar & rest Rich1.SelStart = foundpos - 1 Rich1.SelLength = Len(Word) Rich1.SelColor = color End If
Rich1.SelLength = 0 End If If foundpos = 1 Then tstart = tstart + 1 End If
Loop While foundpos > 0 endx:
Rich1.SelStart = currchar Rich1.SelColor = &H0& foundpos = 0 eletter = "" sletter = "" Rich1.Enabled = True
End Function
Public Function clearwordcolors(Rich1 As RichTextBox)
If Rich1.SelLength > 0 Then Exit Function Rich1.Enabled = False currchar = Rich1.SelStart
thisLine = Rich1.GetLineFromChar(Rich1.SelStart) 'Form1.Caption = KeyCode tstart = Rich1.SelStart tend = Rich1.SelStart With Rich1 Do Until .GetLineFromChar(tstart) <> thisLine tstart = tstart - 1 If tstart < 0 Then tstart = 0 Exit Do End If Loop
Do Until .GetLineFromChar(tend) <> thisLine tend = tend + 1 If tend > Len(.Text) Then tend = Len(.Text) + 1 Exit Do End If
Loop End With If tstart = 1 Then tend = tend - 2 End If If tstart > 1 Then tstart = tstart + 1 tend = tend - 1 End If holdtstart = tstart holdtend = tend Rich1.SelStart = tstart Rich1.SelLength = tend - tstart Rich1.SelColor = &H0& Rich1.SelLength = 0 Rich1.SelStart = currchar holdtend = tend Rich1.Enabled = True
End Function
Rich1: Private Sub Rich1_KeyUp(KeyCode As Integer, Shift As Integer) setcolors End Sub
Private Sub Rich1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) setcolors End Sub
Public Sub setcolors() commentchar = "'" longvar = "$" If KeyCode = 13 Then Exit Sub LockWindowUpdate Me.hWnd clearwordcolors Rich1 ColorizeWord Rich1, "longvar", &H80& 'This is for vars with no fixed lenght e.g (in perl _ it could be $122434 0r $myvarx or $x ..... Always set this ($) as first word to colorize ColorizeWord Rich1, "", &H8000& 'This char is for comments like this ''''''''''''''''''''''''''''''''''''''''''''''''''''''' ColorizeWord Rich1, "mes", &H800000 ColorizeWord Rich1, "and", &H800000 ColorizeWord Rich1, "random", &H800000 ColorizeWord Rich1, "append", &H800000 ColorizeWord Rich1, "binary", &H800000 ColorizeWord Rich1, "exit", &H800000 ColorizeWord Rich1, "then", &H800000 ColorizeWord Rich1, "goto", &H800000 ColorizeWord Rich1, "case", &H800000 ColorizeWord Rich1, "select", &H800000 ColorizeWord Rich1, "end", &H800000 ColorizeWord Rich1, "Select Case", &H800000 ColorizeWord Rich1, "End select", &H800000 ColorizeWord Rich1, "for", &H800000 ColorizeWord Rich1, "each", &H800000 ColorizeWord Rich1, "loop", &H800000 ColorizeWord Rich1, "While", &H800000 ColorizeWord Rich1, "Until", &H800000 ColorizeWord Rich1, "for each", &H800000 ColorizeWord Rich1, "Next", &H800000 ColorizeWord Rich1, "True", &H800000 ColorizeWord Rich1, "False", &H800000 ColorizeWord Rich1, "sub", &H800000 ColorizeWord Rich1, "function", &H800000 ColorizeWord Rich1, "Integer", &H800000 ColorizeWord Rich1, "As", &H800000 ColorizeWord Rich1, "Private", &H800000 ColorizeWord Rich1, "Dim", &H800000 ColorizeWord Rich1, "else", &H800000 ColorizeWord Rich1, "else if", &H800000 ColorizeWord Rich1, "Public", &H800000 ColorizeWord Rich1, "Close", &H800000 ColorizeWord Rich1, "Open", &H800000 ColorizeWord Rich1, "End If", &H800000 ColorizeWord Rich1, "If", &H800000 ColorizeWord Rich1, "(", &H800000 ColorizeWord Rich1, ")", &H800000
LockWindowUpdate 0& Rich1.Enabled = True If Rich1.Visible = True Then Rich1.SetFocus End If End Sub
Text1: Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{tab}", True KeyAscii = 0 Rich1 = Rich1.Text & vbCrLf & " mes " & """" & Text2 & """" Text2 = "" End If End Sub El rpoblema esque no me esplicaron bien el module y etnonces pormi solo nose nada sobre lo que esta mal en el module. Se agradece la ayuda de antemano^^
|
|
|
|
|
|
|