|
Hi,
I need some help with a question.
First I am using VBScript for a client side spellchecker. The code below works but does not keep the rich text formatting that I need.
Sub RichTextSpellChecker(ItemToCheck)
Dim WordObject
Dim WordDocumentObject
Dim strReturnValue
Dim strValueToCheck
strValueToCheck = "" & document.getElementById(ItemToCheck).innerTEXT
IF NOT (strValueToCheck = "") THEN
'let the user know that the spelling is being checked.
window.status = "Spell Check is processing, please wait this may take a few seconds."
'Create a new instance of word Application
Set WordObject = CreateObject("word.Application")
'set window parameters
WordObject.WindowState = 2
WordObject.Visible = False
'Create a new instance of Document and add the text to the document
Set WordDocumentObject = WordObject.Documents.Add( , , 1, True)
WordDocumentObject.Content = strValueToCheck
WordDocumentObject.CheckSpelling
'Return spell check completed text data
strReturnValue = WordDocumentObject.Content
'give the corrected spelling to the textbox that was checked
'MsgBox(strReturnValue)
document.getElementById(ItemToCheck).innerTEXT = strReturnValue
' House Cleaning
'Close Word Document
WordDocumentObject.Close False
'Set Document To nothing
Set WordDocumentObject = Nothing
'Quit Word
WordObject.Application.Quit True
'Set word object To nothing
Set WordObject= Nothing
'let the user know that the spell check has completed. just incase it takes a few seconds to reload the page.
window.status = "Spell check is complete"
END IF
End Sub
As you can see I am using innerTEXT because if I try to use innerHTML the spellchecker will come back and tell me that
HI is spelled incorrectly. Is there a way to keep the text formatting while using the spellchecker?
Thanks
William O'Malley
__________________
|
|
|
|
|
Greetings,
I would like to know,If I can change my form shape from square
to a rounded corners one.
And how do I create it?
Thank you very much Yamarain
|
|
|
|
|
Here are a few links that should get you started:
http://www.freevbcode.com/ShowCode.Asp?ID=3723[^]
http://www.windx.com/codemag/Article/11518/0/page/2[^]
Sorry they are not CP resources.. I looked and looked and looked.....
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
|
Hey guys!
Could anyone tell me how to do a HTTP POST with the HTTPWebRequest class?
I've looked it up in MSDN and tried several times, but it just won't work...
It would help if I could get a little piece of code... for example logging into yahoo mail or whatever
Thanks a lot!
-Timo
|
|
|
|
|
I have a program that acts just like the right button off the mouse on top of the desktop, it only appears a menu...
here's the code:
Private Sub Form_Load()
Me.Hide
Me.PopupMenu ExecMenu
Unload Me
End Sub
Private Sub mnuDebug_Click()
MsgBox "debug"
Unload Me
End Sub
Private Sub mnuRun_Click()
MsgBox "run"
Unload Me
End Sub
-----------------------------------------------------
I want the program to exit when the ESC key is pressed or when the program lost the focus, just like a normal menu...
The line: Unload Me in Form_Load works well in the IDE but when I build the exe it stop working...
How can I exit my program the way I want?
|
|
|
|
|
Hello,
A quite simple question :
I have add an error handler to my VB project. Everything's perfect. But when I catch a run-time error, how to get the line number where the error occurs ?
I'm using VB6 and I haven't find such property on the err object.
Thanks in advance !
|
|
|
|
|
Broker2003 wrote:
I'm using VB6 and I haven't find such property on the err object.
That's because the property doesn't exist. You can't determine the line number while in the executable because that information is not saved written to the executable. The closest your going to get is the name of the class or module that generated the error.
RageInTheMachine9532
|
|
|
|
|
VB V5 used to have an undocumented function called Erl that would return it as long as you preceded each line of code with a number. Ech!
To do this now days all i do is set a variable called lineNo in each function I use and incriment that as my code moves on. Then in my error handler I can simply refer to that var as the last point where I was processing. I don;t obviously do this for each and every line of code I have, but rather I number logical groups of code together.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Use the Erl function. But in order to get it work, you need to number your lines of code. A very useful tool is MZTools, which can do that and a lot of other very interesting stuff. (http://www.mztools.com/)
|
|
|
|
|
Does anybody know how to bounce data between two unrelated classes? I know you can call subroutines in the derived class from the base class, but im not sure how to go the other way. To be more specific, I'm trying to change a property on a control in one form from another. Please help
Scientist have pondered for thousands of years, "What came first? The CodeChicken or the egg?".
|
|
|
|
|
Just thought I'd let everybody know that I figured this out and this is how I did it. For instance, if form1 spawns a new class called class1, you dimension a reference to the form inside the class with this code:
public formlink as form1 = form1.activeform
After you've done this, you can call anything from form1 using formlink. For instance to add to a listbox on form1 from class1 you would use this code:
formlink.listbox1.items.add("hello world")
I hope this helps anyone else that is trying to pass data between forms. I know it was easier in vb6, but now that forms are classes, it makes it much more confusing. Thanx for reading
Scientist have pondered for thousands of years, "What came first? The CodeChicken or the egg?".
|
|
|
|
|
if you want to pass data between forms , you can add owned forms, eg:
in Form1:
Dim frm As New Form2<br />
Me.AddOwnedForm(frm)<br />
frm.Show()
in Form2:
Dim frmMain As Form1 = Me.Owner<br />
frmMain.TextBox1.Text = "something from Form2, passed to Form1!"
|
|
|
|
|
I have a problem, I need to set the size of a button in VB6 to 75 pixels and 23 pixels tall. However, the button has a height and width property, but these numbers are a lot larger than 75. Eg, if i set the button to width 75, it would barely be visible, as the default ones are about a width of 1475. Can you please help me with this
|
|
|
|
|
the default units are twips not pixels
if you want to use pixels set the Form's Scalemode property to Pixels..
then set Width, height for the button to 75 , 23
|
|
|
|
|
The following works if only one row & one column is returned in a function
Dim ssql As String
ssql = "select full_name from EMPLOYEE WHERE full_name = '" & usertoLookup & "'"
Dim myCommand As New OleDb.OleDbCommand(ssql, OleDbConnection1)
OleDbConnection1.Open()
EngActivitiesToFind = myCommand.ExecuteScalar()
myCommand.Dispose()
OleDbConnection1.Close()
The following works if dataset / dataview returns multiple rows to bind to datagrid in a function
Dim myCommand As New OleDb.OleDbCommand(strsql, myConnection)
Dim MyAdapter As New OleDb.OleDbDataAdapter(myCommand)
myConnection.Open()
MyActivityDataSet.Clear()
MyAdapter.Fill(MyActivityDataSet, "dcr_track")
EngActivityDataView.Table.Clear()
DataGrid_DCR.Refresh()
EngActivityDataView = MyActivityDataSet.Tables("dcr_track").DefaultView
DataGrid_DCR.DataSource = EngActivityDataView
But how do you handle it in a single function if sometimes your retrieve returns multiple rows and other times a single row dependent on a query that is dynamic and dependent on user input
Thanks
Milancie
|
|
|
|
|
Use the "ExecuteReader" function to obtain a rataReader object. Then you can read the rows one at a time.
Alternatively, you can instantiate a DataSet and "fill" it with your connection and then access the data in the dataset as you would any other database, or use it to fill your datagrid.
There are actually lots of choices and I'm not sure which best fits your situation
pxw
|
|
|
|
|
how can i access to inbox in outlook..
I have outlook 9.0 reference..in VB .NET
I have create new folder call Temp to recieve and send email from my hotmail account...
When I click InBox.. there were lots of mails inside.. and I want to access each message programmatically.. and I dont' really know how to do it..
I tried something like following..
Dim olApp As Outlook.Application<br />
olApp = new Outlook.Application<br />
Dim fldMain As Outlook.Folders<br />
fldMain = gnspNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)<br />
<br />
thatnks
|
|
|
|
|
|
I have following code, but folder.items is not a collection object so it gives me error. I'm using VB .Net not VB 6.0
<br />
Dim olApp As Outlook.Application<br />
olApp = New Outlook.Application<br />
<br />
Dim mail As Outlook.MailItem<br />
Dim nSpace As Outlook.NameSpace<br />
Dim folder As Outlook.MAPIFolder<br />
Dim eInfo As emailInformation<br />
<br />
nSpace = olApp.GetNamespace("MAPI")<br />
folder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)<br />
<br />
For Each mail In <font color = green>folder.Items</font><br />
eInfo.theBody = mail.Body()<br />
eInfo.theCC = mail.CC<br />
eInfo.theFrom = mail.SenderName<br />
eInfo.theTo = mail.ReceivedByName<br />
eInfo.theDate = "12/13/4"<br />
eInfo.theSubject = mail.Subject<br />
eInfo.wayToPrint = 1<br />
PrintEmail(eInfo)<br />
Next<br />
<br />
|
|
|
|
|
Opps! My bad! Following the docs for MAPIFolder and MailItems you must use the built in Iterator Methods of the MAPIFolder. These of GetFirst(), GetNext(), GetLast(), and GetPrevious().
Dim olApp As New Outlook.Application
Dim mailItem As Outlook.MailItem
Dim nSpace As Outlook.NameSpace
Dim ibFolder As Outlook.MAPIFolder
nSpace = olApp.GetNamespace("MAPI")
ibFolder = nSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)
Debug.WriteLine("Number of messages in folder " & ibFolder.Name & ": " & ibFolder.Items.Count)
mailItem = ibFolder.Items.GetFirst()
While (Not mailItem Is Nothing)
Debug.WriteLine("Message Header: " & mailItem.Subject)
mailItem = ibFolder.Items.GetNext()
End While
Microsoft didn't do the greatest job in the world with the documentation on the Office Object Models...
RageInTheMachine9532
|
|
|
|
|
thank you very much RageIn...
|
|
|
|
|
Hi..
I have the following code
<br />
Dim ie As New SHDocVw.InternetExplorer<br />
ie = CreateObject("InternetExplorer.Application")<br />
<br />
With ie<br />
.Visible = False<br />
.Navigate("c:\OutLookStyle.html")<br />
.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER) 'printing the file without showing the print dialog<br />
System.Threading.Thread.Sleep(5000) 'pausing the application to finish printing<br />
End With<br />
ie.Quit()
But i'm getting the following error whenever the project execute
.ExecWB(....)
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in emailPrint.exe
Additional information: Trying to revoke a drop target that has not been registered
(OR)
An error has occurred in the script o this page
Line: 288
Char: 1
Error: 'dialogArguments.__IE_PrintType' is null or not an object
Code: 0
URL: res://c:\\windows\system32\shdoclc.dll/priview.dlg
Do you want to continue running scripts on this page? Yes/No?
But I have no problem or whatsoever, if I debug and put a breakline on .ExecWB(..). the html page get printed without showing printdialog as I excepted. If I dont have a breakline at .ExecWB(..) then I got either or both of above errors( in red )
what would be the reason of getting such errors? and How can i print the web page to printer without showing PrintDialog???
|
|
|
|
|
Hi,
how do i print to the printer from right to left with vb.net
example in vb6:
Printer.RightToLeft = True
Printer.Print "abcd"
Printer.EndDoc
please send me small example
thanking you in advance
From:
yulyos@yahoo.com
http://www.go.to/yulyos
|
|
|
|
|
In Visual Basic 6.0, the Printer object was used for printing; it supported various graphics methods such as Print, Line, and PaintPicture to control what was printed.
In Visual Basic .NET, the PrintDocument component replaces the Printer object. Equivalent graphics methods include the DrawString, DrawLine, and DrawImage methods of the Graphics class.
Imports System.Drawing.Printing
Dim printer As New PrintDocument
printer.Print()
|
|
|
|