|
paulajohn wrote: I am trying every posible ways to prevent this error to show up such as kill the PowerPoint Object and reinstantiate, reboot host if error happen... Howerver, none of my code worked since the system was hung unexpectedly because MS PowerPoint throw the error and system was hung before the pointer returned back to my code.
Instead of focusing on trying to recover from the error, focus on figuring out where the error originates from and handle the error.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Thank you all for the reading and input.
I have no ideal how's the error throw. I put try catch every where but it did not go into the try catch template. Moreover, after every line of code, I had the sub routine to write to system event log such as time, variable that the code did process, etc... It seemed to work just fine when I investigated the system event log because it passed and exit the sub routines normally. I believed my code logic is correct.
I think I will do as Dave's advice. It's really suck when it does not work the way it's expected.
Thanks again
|
|
|
|
|
I cannot find the code on how to create a KeyChar for an "Enter" key. The only tutorial I have found tells me to do it like this:
<br />
Private Sub FormName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress<br />
If e.KeyChar = "Enter" Then<br />
Function1()<br />
End If<br />
End Sub<br />
But this doesn't work. Can someone give me some ideas please? Thank you!
|
|
|
|
|
Example from MSDN:
Imports System
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Public Sub New()
' Create a TextBox control.
Dim tb As New TextBox()
Me.Controls.Add(tb)
AddHandler tb.KeyPress, AddressOf keypressed
End Sub 'New
Private Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
' The keypressed method uses the KeyChar property to check
' whether the ENTER key is pressed.
' If the ENTER key is pressed, the Handled property is set to true,
' to indicate the event is handled.
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
e.Handled = True
End If
End Sub 'keypressed
Public Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
End Class 'Form1
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot for your help!
|
|
|
|
|
Hi,
I have been trying to write a program in VB .net to convert an HTML document to a tiff file. It will be used to retrieve a page from a secure web site that our customers must first login to, then when they pull up the information that we need they will use our activex control to grab the html from the current page and it will then be converted to tiff format and sent to us. I have had no problem working with IE but I have not been able to grab the HTML source from an open firefox window. This is crucial since so many people use firefox over IE. Any assistance would be greatly appreciated.
Thanks!
|
|
|
|
|
View --> Page Source?
File --> Save Page As
Or do you want to retrieve it programmatically?
"a fool will not learn from a wise man, but a wise man will learn from a fool"
"It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt
"Success is going from failure to failure without losing your enthusiasm." - Winston Churchill
My Website || My Blog
|
|
|
|
|
View --> Page Source?
File --> Save Page As
Or do you want to retrieve it programmatically? ActiveX components won't work in firefox you may have to write your own Class Lib.
"a fool will not learn from a wise man, but a wise man will learn from a fool"
"It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt
"Success is going from failure to failure without losing your enthusiasm." - Winston Churchill
My Website || My Blog
|
|
|
|
|
Thanks for the reply
Fair enough... yes I would like to retrieve it programmatically, perferrably with VB code. I suppose that an activex control would not work in firefox in this case, but is there any way of doing this even with a program that the user could simply download and run?
Thanks again for any assistance
|
|
|
|
|
Hi,
I need a Visual Basic .NET source which can capture network traffic in packets. I have found a lot written in C/C++ but i need a Visual Basic .NET version of that.
I already got a version made in Visual Basic 6, but im not able to find a free version to VB.NET!
Please help me!
|
|
|
|
|
|
Oh yea thank you.
But i dont know much about how to implement or call functions, and if you could catch a link where it is made through vb.net that would be great!
|
|
|
|
|
This is my first time with VB.NET and XML, so feeling my way through. In VB6, you could get the text of the xml into a string using the dom.xml. Is there an equivalent in .NET using the XmlTextWriter? I am basically building 2 xml documents, then I need to concatenate them in a string. Is the XmlTextWriter the best way to go to build xml?
Thanks
|
|
|
|
|
I have the above problem figured out. However, my output is odd. Using the following code:
xws = New XmlWriterSettings
xws.Indent = True
xws.CheckCharacters = True
xws.IndentChars = " "
xws.NewLineOnAttributes = True
xws.Encoding = System.Text.Encoding.UTF8
xws.CloseOutput = False
Dim test As New System.Text.StringBuilder
'Create the access request portion
Using xw As XmlWriter = XmlWriter.Create(test, xws)
xw.WriteStartDocument(False)
xw.WriteStartElement("AccessRequest")
xw.WriteAttributeString("xml", "lang", Nothing, "en-US")
xw.WriteElementString("AccessLicenseNumber", "LicNum")
xw.WriteElementString("UserId", "UID")
xw.WriteElementString("Password", "PW")
xw.WriteEndElement()
xw .WriteEndDocument()
xw.Flush()
xw.Close()
End Using
Return test.ToString()
And the output is as follows:
<?xml version="1.0" encoding="utf-16" standalone="no"?>
<AccessRequest
xml:lang="en-US">
<AccessLicenseNumber>LicNum</AccessLicenseNumber>
<UserId>UID</UserId>
<Password>PW</Password>
</AccessRequest>
I set the encoding version in the xmlWriterSettings, so why is it putting in utf-16? Also, I dont understand why there is a line feed between the AccessRequest and its attribute. Is this normal?
Thanks
|
|
|
|
|
Use XMLTextWriter as posted above, but be carefull joining two XML docs, a well-formed xml doc must have a single root. You can create a XMLDataDocument from the XMLTextWriter and using XPath Functions (like selectnodes) you can join the docs easily. Once joined, get xml-string. XPath functions return nodes by using expressions (i.e. Select("\ROOT\SECOND_LEVEL\") returns all nodes under <root><second_level>. With the property InnerText u can access to tag value.
Hope it helps
-----------------
Solo hay 10 tipos de personas, las que saben binario y las que no
|
|
|
|
|
That helps yes, thank you. But I am still not understanding why I am getting the utf-16 encoding attribute when I tell it to use utf-8.
|
|
|
|
|
I've tried setting the encoding for TextWriters,
Dim test As New System.Text.StringBuilder()
Dim twriter As StringWriter = New StringWriter(test)
'twriter.Encoding = Encoding.UTF8 -- Readonly
Dim twriter2 As TextWriter = twriter
'twriter2.Encoding = Encoding.UTF8 -- Readonly
Dim xmlWriter As XmlWriter = New XmlTextWriter(twriter2)
...no success...
It seems that VB Strings do not allow other than utf-16 encoding (mmmm, strings are stored that way...) for "memory-string-writers"
Using files and encoding "utf-8" OK.
"I dont understand why there is a line feed between the AccessRequest and its attribute. Is this normal?"
take a look to xws.NewLineOnAttributes = True
-----------------
Solo hay 10 tipos de personas, las que saben binario y las que no
|
|
|
|
|
"take a look to xws.NewLineOnAttributes = True"
Thanks, that was stupidity on my part. So I'm stuck with utf-16 unless I switch away from a string builder/writer. Thanks for the help.
|
|
|
|
|
In VB 6.0 they used the Printer.Print command to be able to print directly from the form to the printer. I am trying to do that same thing by using code to print from the form to the default printer directly using VB .Net. Any thoughts?
Underwood
|
|
|
|
|
I am trying to print a formatted layout from multiple textboxes to the printer.
Underwood
|
|
|
|
|
I need to have the Source code of a programe about “ sending message, picture, sound, video” through the Lan and wireless”, which is written by VB.net. Please send it to my email: ….. Thanks for your reading and replying
i am pham quang dan
|
|
|
|
|
The only way you're going to get the soruce code for an app like this is if you write it! This isn't Rent-A-Coder. Noone here is goign to write an entire app for you, and certainly not for free.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Come on Dave. Surely YOU have plenty of time for a volunteer project!
Nathan Lindley
|
|
|
|
|
Funny you should mention that! I just got notified that I'll be running my ENTIRE site (2 buildings) on generator power only for an entire day. Extension cords running all over the place keeping the network running because the outage will last much longer than the battery power will...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
I am having one doubt ,is there anyway to draw only vertical lines(not gridlines)
between each column in listview of windows forms.If any one have Idea please guide me how to handle this.
thanks.
Rama
venkat
|
|
|
|