|
Not sure whether this will solve your problem, but try using the WebBrowser control within the .NET Framework.
Change the line :
Public WithEvents IE As New SHDocVw.InternetExplorer
To :
Public WithEvents IE As New System.Windows.Forms.WebBrowser
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Sorry. I thought that worked great but it still has a problem.
I am launching Internet Explorer so that I can parse the DOM on DocumentComplete.
Internet Explorer is never visable after changing the WithEvents that you suggested but it does allow me to access form controls on DocumentComplete.
Any suggestions?
Thanks for the help.
modified 18-Dec-21 21:01pm.
|
|
|
|
|
I have noticed two things that might be relevant to solving your problem.
The actual error is a cross thread error when you try it with a textbox, and when you try it with a simple MsgBox("Hello!"), you'll find it will fire the DocumentComplete event three or four times.
So you could try to create any controls on the fly instead of using existing ones, or you could try to load all relevant information into a class first and then access that class afterward with the controls on your form.
However, if it really fires the event multiple times, you may have to think of a way first to determine which is the final / relevant instance of the event.
My advice is free, and you may get what you paid for.
|
|
|
|
|
The documentcomplete routine does fire multiple times on some web pages due to the number of frames the page contains. This is easily overcam by using the following code in the documentcomplete routine:
If IE.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE Then
TextBox1.Text = "Hello"
End If
Everything works perfectly if I do everything in the Button1.Click routine like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
IE.Visible = True
IE.Navigate(SiteUrl)
Do Until IE.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
Loop
TextBox1.Text = "Hello"
'Parse web page DOM routine Here
End Sub
But as soon as I take everything after the Do Until Loop and put it in the DocumentComplete routine. I loose control over the DOM and all form controls.
I hope that this helps explain my situation better then I have in previous posts.
I really do appreaciate everyone's assistance on this problem. It is driving me crazy.
Pertains to using Public WithEvents IE As New SHDocVw.InternetExplorer as in my first post.
Keep those ideas coming.
modified on Thursday, September 25, 2008 4:21 PM
modified 18-Dec-21 21:01pm.
|
|
|
|
|
Many thanks goes to Johan Hakkesteegt for his great assistance.
With his suggestion, I scoured the wonderful world of Google and fixed the textbox1 problem in the DocumentComplete routine.
Here it is for anyone else that might have the same problem.
Public Class Form1
Public WithEvents IE As New SHDocVw.InternetExplorer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.Navigate("http://www.yahoo.com")
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, ByRef URL As Object) Handles IE.DocumentComplete
If IE.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE Then
Try
Me.TextBox1.Invoke(New MethodInvoker(AddressOf Textbox1Change))
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
End Sub
Private Sub IE_OnQuit() Handles IE.OnQuit
IE = Nothing
End Sub
Private Sub Textbox1Change()
TextBox1.Text = "Hello"
End Sub
End Class
This works great(even if it does add to code length) for working with form controls inside an external browser's DocumentComplete routine.
Note: The above routine also takes into account the DocumentComplete routine firing more then once (once for each frame).
Awesome.
modified on Thursday, September 25, 2008 9:25 PM
modified 18-Dec-21 21:01pm.
|
|
|
|
|
If the focus is on textbox1 then I want the font color label1 to be red or else it is black.
I have used this
if textbox1.focus = true then
label1.forecolor=color.red but it does not work. Is this even possible in vb.net?
|
|
|
|
|
OK, so how is this code getting executed? What method is it sitting in?
|
|
|
|
|
You could always just use the Enter and Leave event procedures to change the font color of the label. The code in the Enter event procedure could change the color to red, and the code in the Leave event procedure could change back to black.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Assuming that what this function on several text boxes, then I would create a composite control consisting a text box and label. Then on the Enter event of the control change the fore color of the label and again on the Leave event.
Now you have the start of a control that can be used over and over again.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
That's a better idea than mine. I didn't really stop to think about using a custom control in the event the OP needed to do this for more than one textbox/label.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have my moments
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
i have got it figured out. the label will not change color text is entered into the textbox. i just pasted the code behide each textbox.
label1.forecolor=color.red
then the rest of the labels were initialized to black and as the next textbox starts to get information entered into it the last label changes to black and the current one changes to red. but i thank you gentleman for the input and i will try and attempt to use some of your suggestions.
Thank you all.
|
|
|
|
|
I'm trying to put an application together with NDK C3PO that would capture the contents of a message in Groupwise e.g. (Subject, Message Body) etc. and then write that data to a database like Access. Does anyone know where I would even start with this?
|
|
|
|
|
Tech support at the publisher/author of the NDK C3PO
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I don't understand your response. Are you talking about their documentation? If that's the case, it is very vague and does not go into detail on how to reference the areas that I mentioned with sections of an e-mail message.
|
|
|
|
|
You'll have to consult with Novell's docs for how to capture the contents. Once you have the email parts, it's fairly easy to put it into a database, and there are a lot of articles on CodeProject that demonstrate doing so. (Even more on Google.) Once you get started, if you have specific questions post them - you'll get more helpful replies to specific questions.
|
|
|
|
|
Could you tell me where these specific articles are? I've been looking everywhere for information on it and theres very little.
|
|
|
|
|
|
Hello everyone,
I hav been facing a problem since a few days. I'm using crystal report with vb.net 2005 (.Net framework 2.0). In a report I'm retrieving the values from a database table and showing it. But the problem is that if a certain field is blank in database then it's showing a complete blank white field in the report also. This is what I don't want. For example- suppose there's a field in datbase named EntryDate which is not mandatory. So for a certain row if there's an entry for EntryDate it'll show it in the report otherwise if it's blank or null in database it'll show a user defined string in the report say 'Not Available' or something like that. For this I hav tried playing with the ZeroValueString property of the respective field in the crystal report also but of no avail. How can I solve it. Plz help with some code example.
Regards.
|
|
|
|
|
no code here but why dont you place a default value eg. "Not Available" in the textbox that EntryDate to the database.
thus
if EntryDateTextbox.text = "" then
' Where -Not Available- is your default text which will be sent to the database if the textbox is empty
EntryDateTextbox.text = "Not Available"
endif
so when you create the crystal report, the EntryDate field would not be empty.
Hope This Helps
Freddie_xan
this is eddie, currently about to study oracle10g, abut also presently developing sample project softwares
|
|
|
|
|
Actually the datatype for EntryDate is DateTime in the database. So only a legal Datetime value or Null value can be passed. In the front end interface I'm not using any textbox, instead there's a datetime picker. If somebody selects any date it is passed in the database otherwise NULL is passed.That's why when I retrieve data from that table in crystal report it can't show anything else other than a blank if the entrydate is null in database. Moreover if suppose, the entrydate textbox in crystal report has background color say Gray, but when no data can be retrieved for the field it is turning completely white- a white field among all gray fields, so awkward.
By the way I'll request you to focus on the ZeroValueString property of a
textbox in crystal report. As per what I hav read from other sources, the
ZeroValueString property shows a custom defined Value/String in a textbox if Null value is retrieved from database. I hav played with it but couldn't figure it out. Can u solve it. Awaiting for ur reply. Thanks.
Regards.
|
|
|
|
|
Create a formula field in the report that will contain either the date formatted as a string, or a "Not Available" if the date is a null value.
|
|
|
|
|
Hello,
I have this code:
Private Sub Form_Load()
Dim lab(30, 100) As Label
Dim i As Integer, j As Integer
For i = 1 To 30
For j = 1 To 100
lab(i, j).Caption = "A"
lab(i, j).AutoSize = False
lab(i, j).Height = 13
lab(i, j).Width = 9
lab(i, j).Left = j * 9
lab(i, j).Top = i * 13
Next j
Next i
End Sub
and have this error:
Runtime error '91':
Object variable or With block variable not set.
Help me please!
T.I.A
|
|
|
|
|
You have only declared the label object, not instantiated it...
Try this:
set lab(i, j)= New Label
as the first line of the inner loop
HTH
|
|
|
|
|
ChandraRam wrote: Try this:
set lab(i, j)= New Label
I had this error:
Compile error:
Invalid use of New keyword
|
|
|
|