|
Take the variables excelApp, excelBook, and excelWorksheet outside of ExtractData2 method. To your form, add a button that creates the three variables mentioned above and initializes the subtitles.
Now that you have a reference to the excelWorksheet, you should be able to append data from your form to any row as long as you keep track of the last row number added.
To close the application:
<br />
excelBook.Close()<br />
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelBook)<br />
excelBook = Nothing<br />
excelApp.Quit()<br />
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)<br />
excelApp = Nothing<br />
|
|
|
|
|
Help ! I'm struggling to get consistent repeatable use of the following code
http://support.microsoft.com/?kbid=311284. I'm basically have an AXWebBrowser control on an MDI form. The page loads a html file with images. The images have an ID tag that I then capture as being clicked and process some action e.g. show another mdi form. Unfortunately it works once but then fails any subsequent clicks. Equally the mouse over event works for a period of time (see Microsoft example) - then stops ! Randomly. The event capturing just does not fire. Anyone out there have example code ? I just cant get reliable event firing from the Microsoft example.
|
|
|
|
|
i am working on an application which is a door terminal application, now i want to implement a function which is when there is no one touch the application there is a screensaver application(which i also did it ) come up. how to implement this, especially how to detect no one touched the application within certain time!
I am Entry level person
|
|
|
|
|
Set a timer to start your screensaver. reset it every time your app recieves a keyboard or mouse event.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
this is an example of out I set a textbox:
Private Function InputBoxValue(ByVal controlname As String, ByVal value As String)
Dim tmpIBox As mshtml.IHTMLInputTextElement = doc.getElementsByName(controlname).item(, 0) 'get first name inputbox
tmpIBox.value = value
End Function
But I can't for the life of me figure out how to set a radio value... example:
<INPUT NAME='DL_trial_timeAmPm' TYPE=radio VALUE='AM' >AM<INPUT NAME='DL_trial_timeAmPm' TYPE=radio VALUE='PM' >PM<P>
Thanks in advance.
|
|
|
|
|
kjhkjhkjhkjhkjhkjhkjhkjh wrote: But I can't for the life of me figure out how to set a radio value... example:
For the life of me I can't figure out what you are talking about. If you want help, help us and yourself by explaining your programming problem better and in more detail.
...Steve
|
|
|
|
|
I need to set a radio value on a webpage....... I programmatically login into the website using the axwebbrowser control. Then from there on I use getElementsByName Method on the document to get the fields value or set it. I can get the method to work for every other field type except radio option which is an input field. If you've never worked with html and this object you'll of course have no idea what I'm talking about. Again thanks in advance if you have any help in this matter.
example that I'm trying to perform:
Private Function InputRadioValue(ByVal controlname As String, ByVal value As String)
Dim tmpIBox As mshtml.IHTMLOptionButtonElement = doc.getElementsByName(controlname).item(, 0) tmpIBox.checked = True
End Function
I've changed the index on the item but it doesnt seem to point to the right value
|
|
|
|
|
nice username. is that your real name?
I wish my username was that cool.
Pumk1nh3ad illustrates that Intelligent Design oft goes awry. - Ed Gadziemski
|
|
|
|
|
Try this...
Dim tmpIBox As mshtml.IHTMLInputTextElement = doc.all.item(controlname, 0)
...Steve
|
|
|
|
|
I receieved the following error when I used the code on the previous thread. "QueryInterface for interface mshtml.IHTMLInputTextElement failed" Now the code that I used before was:
Dim tmpIBox As mshtml.IHTMLOptionButtonElement = doc.getElementsByName(controlname).item(, 0) 'get first name inputbox
tmpIBox.checked = True
now this code worked for the first option value but there are two with the same name like so:
AMPM
so basically I need to get the second option now when i try to change the index.. it doesn't work. any suggestions?
|
|
|
|
|
found out the problem .......the example they had doc.getElementsByName(controlname).item(, 0) was wrong..... there is not supposed be a comma in the index!!! lol :->
|
|
|
|
|
Ahhh...I always like the simple solutions! Glad you found it. Thanks for posting your resolution as it helps others in the same situation. BTW, I like your new name.
...Steve
|
|
|
|
|
Hi All,
I want to Import Data From Oracle DUMP File *.DMP into SQL Server.
how can i import data from Oracle Exported *.DMP to SQL sever ,
Thanks in Advance.
Muhammad Nadeem.
|
|
|
|
|
Hi all
I have the following piece of code where I am checking for the status of the printer. But I am not able to figure out why even while the printer is priting Printer.PrinterStatus returns 2 which corresponds to Unknown printer status
Please let me know if the code is wrong and is there any other way to check for the status of the printer.
Code is
Private Sub btnPrinter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrinter.Click
Dim PrinterSet As Object
Dim Printer As Object
Dim DefaultPrinter As Object
PrinterSet = GetObject("winmgmts://localhost")
DefaultPrinter = PrinterSet.ExecQuery("Select * from Win32_Printer Where Default = True")
For Each Printer In DefaultPrinter
MsgBox(Printer.Name & ": " & Printer.PrinterStatus)
Next Printer
End Sub
Thanks and Regards
VanitaJ
-- modified at 19:34 Monday 7th November, 2005
|
|
|
|
|
I put the code under timer event of very small duration and it worked fine.
But I dont get any other states than IDLE,UNKNOWN,PRINTING.
How to retrieve the printer state like warmingup,paper jam,toner low etc
If anyone has idea about it please let me know
Thanks and Regards
VanitaJ
|
|
|
|
|
You can't get that information because it's not exposed to the WMI methods your using. You can only the same information you see if you open the Printers folder to see the details of all the printers installed on the system.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So can I get the required information if I use System.Management.ManagementObject class ?
~VanitaJ
|
|
|
|
|
You can't get it if the underlying provider doesn't supply that kind of status information to WMI. You'll have to use other methods to get more granular status information. This may include P/Invoking the Win32 API GetPrinter function, communicating with its driver using DeviceIo, or getting the information directly from the printer depending on how it's connected to the machine and if it supports such methods.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hello...
I'm new to network programming and am trying to create a simple application that will allow me to send test TCP messages to a listening windows service. Here is my send function:
<br />
Function Send(ByVal message As String) As String<br />
Dim stream As NetworkStream = Nothing<br />
Dim responseData As String = ""<br />
Dim localEP As New IPEndPoint(IPAddress.Parse("127.0.0.1"), 11000)<br />
<br />
Try<br />
<br />
' Instantiate a TcpClient with the target server and port number<br />
Dim client As New TcpClient(localEP)<br />
<br />
' Convert the data to send into a byte array<br />
Dim data As Byte() = System.Text.Encoding.ASCII.GetBytes(message)<br />
<br />
' Get the NetworkStream for the TcpClient for sending and receiving<br />
stream = client.GetStream()<br />
<br />
' Send the message to the server. <br />
stream.Write(data, 0, data.Length)<br />
<br />
' Buffer to hold data returned from the server.<br />
data = New [Byte](256) {}<br />
<br />
' Read the response from the server up to the size of the buffer.<br />
Dim bytes As Integer = stream.Read(data, 0, data.Length)<br />
<br />
' Convert the received bytes into a string<br />
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes)<br />
<br />
Catch ex As SocketException<br />
MsgBox(ex.Message)<br />
Catch ex As IOException<br />
MsgBox(ex.Message)<br />
Finally<br />
<br />
' Make sure that the NetworkStream is closed.<br />
If stream IsNot Nothing Then<br />
stream.Close()<br />
End If<br />
<br />
End Try<br />
<br />
Return responseData<br />
End Function<br />
<br />
The line of code as follows...stream = client.GetStream() causes this InvalidOperationException :
The operation is not allowed on non-connected sockets.
I'm using VS 2005 Beta 2 (.NET 2.0). I have no idea what the problem is. Any ideas?
Thanks in advance!
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
You have to get connected before to do anything!!
sockSMTP.Connect(v_Remote)
Then you can do what you want. I hope it helps
|
|
|
|
|
Could anybody help me. Im trying to work out how to use a progress bar with the browser control so i can see how much of the page is loaded etc like in internet explorer.
If anybody has any demo programs or sample code or could explain it i would be grateful.
Mo.
|
|
|
|
|
I found this page[^] that gives an example of how to use a progress bar in a web browser control (VB.NET). The example uses the DownLoadBegin, DownLoadComplete, and ProgressChange events of the browser control. I didn't try the code but it looks relevant...
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
I have two combo boxes in my datagrid.
I need to be able to select a value in one (databound) combobox and have the values in the other (on the same row) change (run a new SQL statement based on the value selected and repopulate).
Have you (the reader) done this before and/or can you point me to a resource?
Let me know if I am too cryptic.....
Thanks in advance.
|
|
|
|
|
I am not sure this will help you, but in cases where I have controls whose contents change based on other controls I find most suitable to use DataViews.
|
|
|
|