|
I meant dragging a ClassA-item from your Toolbox to the Form; just like you add any other control to the form
I are Troll
|
|
|
|
|
Thank you for the tip
Shay Noy
|
|
|
|
|
Hi,
I'm connecting client to server using VB6 Winsock Controls
'==========Serverside============================
Winsock1.Protocol = sckTCPProtocol
Winsock1.RemoteHost = strParm(0)
Winsock1.RemotePort = 1002
Pause (7)
MsgBox "Before Connecting" 'just to do something, and give time to establish connection
Winsock1.Connect
MsgBox "After Connecting"
DoEvents
'Delay2 = 1
Pause (10)
'Winsock1.SendData ("Starting dropship refresh...")
It works fine with the MsgBox between the Connect and the Senddata, but without it gives an error when firing Senddata method, seems because connection is not established quick enough.
Please help, how can I ensure connection before sending data?
I have tried some 'delay' processes which works 1 minute and doesnt the next.
Thanks in advance
P
|
|
|
|
|
Why are you using VB6 ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This is an enhancement to an existing big VB6 system. i'm just addind this bit.
P
|
|
|
|
|
|
Hi i am currently using this following code to test if the user enters in anything else besides numeric values:
I am having trouble because if I try to use the enter key or backspace key it also views it as a alphanumeric character and will display the error message but I WANT TO ALLOW THE ENTER AND BACKSPACE KEY any SUGGESTIONS?
Private Sub txtAns_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAns.KeyPress
'*************************************************************************************
'in this subroutine when the user clicks on the text box to enter in his/her numeric value
'I will test for numeric validation and if the user tries to enter anything other then a number
'an error message will be displayed.
'*************************************************************************************
' textbox1 just accept numeric data
If Char.IsNumber(e.KeyChar) Then
e.Handled = False
Else
'numeric value has not been entered so display appropriate error msg and allow user to try again
MessageBox.Show("Please Enter Numbers Only")
txtAns.Clear()
e.Handled = True
End If
End Sub
|
|
|
|
|
Why not use a NumericUpDown control instead?
Anyways, in your code, just add a check if the KeyChar value is equal to that for enter and delete key.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
So would this be correct syntax??? in VB.NET
If Char.IsNumber(e.KeyChar) & ascii = 13 & ascii = 8 Then
e.Handled = False
Else
|
|
|
|
|
PAguilar09 wrote: ascii = 13 & ascii = 8
How can the same variable have two different values ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I guess you would be better off using textchanged event for checking the textbox text instead of Keypress since those will not fire if copy/paste anything in your textbox through mouse.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
You can do the following:
Imports Microsoft.VisualBasic ' at the begining of your .vb file
If Char.IsNumber(e.KeyChar) Or e.KeyChar=ChrW(Keys.Return) Or e.KeyChar=ChrW(Keys.Back) Then
e.Handled = False
Else
' etcetera
End If
Best regards,
Jaime.
|
|
|
|
|
THANKS JAIME UR CODE WORKED PERFECTLY!!!
|
|
|
|
|
Best regards,
Jaime.
|
|
|
|
|
A better bet is Char.IsNumber or Char.IsControl
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Nope. It wont be. The user will be able to copy/paste anything in the textbox that way. I hope you meant this:
if(!char.IsControl(e.KeyChar) && !char.IsNumber(e.KeyChar)){
e.Handled = true;
}
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Yes, that is what I meant. I just meant to use IsControl instead of checking for specific control characters.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
User can still copy paste anything via mouse.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Something else to note... the way your code currently is, someone could key in 20 digits, then accidentally hit the A key and it will delete the 20 digits previously entered because of this line:
PAguilar09 wrote: txtAns.Clear()
Is that really what you are wanting to do?
|
|
|
|
|
_Damian S_ wrote: Is that really what you are wanting to do?
I would. Make them do it right first time
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Single application; one module and two forms, each with its own SAPI 5.1 speech object. The module loads and shows each form. Each form has a button on it that invokes the corresponding speech object (Speech1.speak for Form1 and Speak2.speak for Form 2). Push either button first and speech is output by that forms speech object. Push the other forms button and no speech results.
MS SAPI Docs states that SAPI speech object can share the same output device, in this case the pc speaker.
Any ideas..
Rick
|
|
|
|
|
I have never worked with this object however what are you expecting to come out the speaker, a merging of the 2 speech sets?
At a guess I would say that Speech1.speak probably takes control of the device and has not released it, try looking for a terminating method Speech1.shutup is a possibility.
|
|
|
|
|
Each set of text to be converted to speech is placed into a stream ojbect and that stream is assigned a unique number. Stream are queued; so, no, merging works only if the default methods for processing streams is over-ridden.
Note that the docs describe what I am trying to accomplish. I would not like to have to call MS on this; chances are they would get it wrong and I would have to pay anyway.
And, Yes, it is possible to shut the one object down with and = Nothing. However, the object would have to be re-instantiated (is that a real word?) again. Not a good thing to have to do.
|
|
|
|
|
Hi,
I have several Excel UDFs in a DLL created with VB (VB2008 Express) and .NET 3.5 SP1
My existing UDFs in this DLL work fine when called from Excel (2003).
I am now trying to add a new UDF that requires the name of the workbook and worksheet of the cell calling the UDF.
I cannot get the ActiveCell or the Application.Caller functions to work. I have searched for some time and tried various methods, but Intellisense always shows that they are wrong and when built, re-registered, and accessed from my test function =XTest(A1) they (not surprisingly) return an error.
I have :
Option Infer On
Option Strict On
Option Explicit On
and the following Imports:
Imports System
Imports System.Math
Imports System.Runtime.InteropServices
Imports XL = Microsoft.Office.Interop.Excel
The following references are used (possibly more than I need, but I have tried various routes to get this to work):
Microsoft Excel 11.0 Object Library
Microsoft Office 11.0 Object Library
Microsoft Windows Common Controls 6.0 (SP6)
OLE Automation
System.dll
System.Core.dll
System.Data.dll
System.Data.DataSetExtensions.dll
System.Runtime.Remoting.dll
System.Xml.dll
System.Xml.Linq.dll
Microsoft Visual Basic for Applications Extensibility 5.3
I have an Interface section, which includes a test UDF I am using to try and access the calling cell's address, workbook and worksheet's names:
<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
Public Interface ComIF
'test function
Function XTest(ByRef XTRange As XL.Range) As Object
and the public class with the function code:
' Class that implements the Interface
<Guid("9FEB08E8-B561-4e9e-9990-C73D02B206C5"), _
ClassInterface(ClassInterfaceType.None), ProgId("HumarFunctions.Functions1")> _
Public Class Functions1 : Implements ComIF
Public Function XTest(ByRef XTRange As XL.Range) As Object Implements ComIF.XTest
On Error GoTo MyErr
<various bits of code to try and return the calling cell address
none of which work !>
Exit Function
MyErr:
XTest = CVErr(CVErrEnum.ErrNA)
End Function
End Class
Any advice on how to access the active cell or the calling cell, or pointers to suitable articles or posts would be much appreciated.
Regards
|
|
|
|
|