|
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
|
|
|
|
|
|
This is the second time you have asked this question, and even though Christian suggested using Google, you don't appear to have done it. Try searching for SAPI VOICES and see how many hits you get.
|
|
|
|
|
quadrilateral wrote: Any Suggestions?
Any and all help is appreciated.
Apparently not, because I solved it for you, and you are asking the same thing again, without any reference to the things I suggested you try. Perhaps you're just out of your depth ?
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.
|
|
|
|
|
We have a requirement for the users to be able to paste data from Excel into a Data Grid View in a vb.net application.
I have constructed the following based on the post here[^] on working with the clipboard, and article here[^] on working with XML data .
If Clipboard.ContainsData("XML Spreadsheet") = True Then
Dim ms As MemoryStream = CType(Clipboard.GetData("XML Spreadsheet"), MemoryStream)
Dim b(CInt(ms.Length)) As Byte
ms.Read(b, 0, CInt(ms.Length))
Debug.Write(CStr(System.Text.UTF7Encoding.UTF8.GetString(b)))
'=====================================================
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
'Create the XML Document
m_xmld = New XmlDocument()
'Load the Xml content from the clipboard
m_xmld.LoadXml(System.Text.UTF8Encoding.UTF8.GetString(b))
'Get the list of name nodes
m_nodelist = m_xmld.SelectNodes("/Workbook/Worksheet/Row")
'Loop through the nodes
For Each m_node In m_nodelist
'Row data code here
Next
'=====================================================
Else
MsgBox("No XML Spreadsheet data on clipboard")
End If
Am getting the error:
'.', hexadecimal value 0x00, is an invalid character. Line 35, position 1.
Line 35, position 1 corresponds to the end of the XML Spreadsheet data from the clipboard each time.
XML Data is copied from the clipboard OK but don't know if the character encoding is different maybe? Or do I need to strip some characters out?
Just can't seem to get past this error I'm sure its something obvious that I'm missing.
Any ideas?
Thanks in advance.
Alex.
|
|
|
|
|
Not sure about this particular scenario, but this error comes in case your XML contains trailing empty characters. Trimming up the values while reading might just do the trick.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thanks for the reply d@nish. Had tried a straightforward trim() already with no success. Eventually tracked down a sample function here[^] to strip the illegal chars.
Public Function CleanString(ByVal s As String) As String
Dim st As String = s
For i As Integer = 0 To 7
st = st.Replace(Chr(i), "")
Next
For i As Integer = 11 To 12
st = st.Replace(Chr(i), "")
Next
For i As Integer = 14 To 31
st = st.Replace(Chr(i), "")
Next
Return st
End Function
Seems weird though that Excel would produce XML that was not able to be directly used elsewhere without some kind of 'Clean up' operation. Or am I missing an obvious easier way round this??
Cheers,
Alex
|
|
|
|
|
Hi,
I want to paste Texts and Table from RichTextBox to Email Body.
Is it possible?
Dim mm As New System.Net.Mail.MailMessage(FrmMail, ToAddress)
blah...blah...blah...
richtextbox5.copy
mm.body=richtextbox5.paste ???????????
Suppose, "mm.body=richtextbox5.text" is not displaying the table lines...
Any Ideas, Thanks
|
|
|
|
|
1. don't double post. If anybody knows, and has the time, they will answer.
2. have you tried anything or are you just wanting someone to write your code for you?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi Bob,
Sorry Bob.
If someone searched for Richtextbox to email body or msword to email body messages, those posts will help them.
Otherwise I wont create.
Anyhow thanks for the suggestion.
Iam looking for sample.
|
|
|
|
|
Well, an email body is just a string, you have to set the format in other ways. Google for html or rich text emails and you should find plenty of pointers.
Secondly, have you ever seen richtextbox.paste because haven't - its not a function. In code you paste from the clipboard, but thats not what you need to do here.
There are loads of examples for sending formatted email if you search for them, but remember, regardless of the format you create in, its the recipients email client that decides how to display, and many people choose plain text so all your efforts go out the window.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
1. I have a table in MS-Word Document.
Is it possible to copy that table to my Email-Body with table lines?
Any ideas ?
Thanks
|
|
|
|
|
Paramu1973 wrote: I have a table in MS-Word Document.
What version of Word?
Paramu1973 wrote: Is it possible to copy that table to my Email-Body with table lines?
Yes. The email needs be in HTML-format though, as a text-only message would need be converted to ASCII-art.
Paramu1973 wrote: Any ideas ?
Save it as RTF or HTML and grab the piece that describes the table
--edit--
Just saw an unanswered question, noticed the other thread too late. Sounds like good advice to me
I are Troll
|
|
|
|
|
Dear All
I am writing a simple program for a billing system. I use a cash drawer and a dot matrix printer. When I give a print command, I want to open that cash drawer tray. Can anyone help me to write the code for that?
Thanks
|
|
|
|
|
how do you connect to the cash drawer mechanism? maybe the SerialPort class can help you?
you are not givvin' us much info to work with.
|
|
|
|
|
First, stop what you are doing, chuck VB6 out and download VB.Net express, IT IS FREE. It may be a bit of a learning curve but at least it is a supported platform. VB6 is a DEAD platform.
|
|
|
|
|
What makes you think anyone can help you, without knowing what sort of cash register you have, how it works, and how you hope to interact with it ? As someone else said, VB6 is rubbish, you'd have to be insane to start a project with it today.
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.
|
|
|
|
|
As others have comment, VB6! history!
I would add, dot matrix printer? equally history.
In fact, a "program to open a cash drawer when you print", surely all cash registers come with that functionality built in!
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
The Man from U.N.C.L.E. wrote: As others have comment, VB6! history!
I would add, dot matrix printer? equally history.
There are quite some developing countries who are still living in that history. The world isn't upgrading as a whole, and it'll take a while before everyone saved enough money to buy Windows 7 and a new dual-core.
We're talking developing countries, where the companies aren't interested in the support that Microsoft isn't giving on VB6. Think computers that run Windows 98 without automatic updates. You don't want to install .NET on such a machine
I are Troll
|
|
|
|