-
Feb 19th, 2006, 01:12 AM
#1
Thread Starter
Addicted Member
Send a message with a command button
how can i send something through a txtbox with a command button? example if i click cmdbutton1 it will send a message through the txtbox without me typing it??I would appreciate the help thank you
-
Feb 19th, 2006, 01:26 AM
#2
Re: Send a message with a command button
VB Code:
Private Sub Command1_Click()
Text1.SetFocus
'text1.SelStart = len(text1.Text) 'To start typing at the end
'text1.text = "" 'To remove old text before writing
SendKeys "hello", True
End Sub
-
Feb 19th, 2006, 01:36 AM
#3
Re: Send a message with a command button
Where do you want to send it? another programs text box or are you talking about using NET SEND service?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Feb 19th, 2006, 01:32 PM
#4
Thread Starter
Addicted Member
Re: Send a message with a command button
andrew the problem with your code is that it writes it but doesnt send it.. roddog im not quite sure what you mean by NET SEND services
-
Feb 19th, 2006, 01:36 PM
#5
Re: Send a message with a command button
do you mean
text1.text = "hello"
if not you could use sendmessage with WM_SETTEXT
-
Feb 19th, 2006, 01:42 PM
#6
Thread Starter
Addicted Member
Re: Send a message with a command button
again all text.text= "hello" does is write it but doesnt send it i would like it to send it and could you explain what WM_SETTEXT is?
-
Feb 19th, 2006, 01:42 PM
#7
Re: Send a message with a command button
NET SEND is where you can send messages to other systems on your network.
SendKeys only send the keys to the window that has the focus. So if you want it sent to a unfocused window it will either need to be activated first or use a more reliable method.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Feb 19th, 2006, 01:48 PM
#8
Thread Starter
Addicted Member
Re: Send a message with a command button
so NET SEND could be used in like chat programms because its sending the text to other people??
-
Feb 19th, 2006, 02:37 PM
#9
Re: Send a message with a command button
Yes, but only on your intranet and not internet. Most systems have the Messenger service disabled so it doesnt work since last year or so we had people trying to do spamming with the messenger service.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Feb 19th, 2006, 02:45 PM
#10
Re: Send a message with a command button
You can do this,
VB Code:
Private Const WM_SETTEXT As Long = &HC
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Sub Form_Load()
Dim lng1 As Long
Dim lng2 As Long
lng1 = FindWindow("ThunderFormDC", "form1")
lng2 = FindWindowEx(lng1, 0&, "ThunderTextBox", "Text1")
SendMessage lng2, WM_SETTEXT, 0&, ByVal "hello"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|