|
yes of course excel is installed of my machine,may be the problem with dll files,i dont know.
|
|
|
|
|
Try enclosing the 'Excel 8.0;' in single quotes
The error occurs when accessing extended properties in the JET engine. Google your error message for heaps of info.
The Fanatical All Black Supporter - Kea Kaha
|
|
|
|
|
i want to send the right click sub routine that i've formulated, through send message funtion to windows in vb.net so that it can work same as normal right click does what i am doing is
Public Sub RightClick()
RightDown()
RightUp()
End Sub
Public Sub RightDown()
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
End Sub
Public Sub RightUp()
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
End Sub
Public Sub ClickButton(ByVal ButtonHandle As IntPtr)
'send the right mouse button "down" message to the button...
Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTDOWN, 0, IntPtr.Zero)
'send the right mouse button "up" message to the button...
Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTUP, 0, IntPtr.Zero)
'send the button state message to the button, telling it to handle its events...
Call SendMessage(ButtonHandle, BM_SETSTATE, 1, IntPtr.Zero)
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
RightClick()
ClickButton(Windows.Forms.MouseButtons.Right)
'MessageBox.Show("show")
End Sub
please help me where i am going wrong
farah
|
|
|
|
|
farah mazhar wrote: i want to send the right click sub routine that i've formulated, through send message funtion to windows in vb.net so that it can work same as normal right click does what i am doing is
This doesn't make any sense at all. Are you trying to send a right-click to a control in your app?? Or are you trying to send a right-click to another application's window??
Your other problem is that you copied and pasted this code from another website without understanding what it's doing. I'm willing to be that you have the Declares statements wrong because the code on the other site is written for VB6 and you're using VB.NET. Since there are big differences between the data types with the same names in the two languages, most notably the Long type, the code is not going to work in VB.NET without some conversion.
|
|
|
|
|
this is my code:
Imports System.IO<br />
Imports System.Collections<br />
Imports SHDocVw<br />
<br />
Public Class Form1<br />
<br />
Private browser As SHDocVw.InternetExplorer<br />
Private WithEvents shellWindows As SHDocVw.ShellWindows<br />
Private Current_IE_Handles As ArrayList<br />
<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
'InitializeComponent()<br />
Current_IE_Handles = New ArrayList<br />
<br />
shellWindows = New SHDocVw.ShellWindows<br />
<br />
End Sub<br />
<br />
Private Sub shellWindows_WindowRegistered1(ByVal lCookie As Integer) Handles shellWindows.WindowRegistered<br />
Dim filnam As String<br />
Dim ie As SHDocVw.InternetExplorer<br />
<br />
For Each ie In shellWindows<br />
filnam = Path.GetFileNameWithoutExtension(ie.FullName).ToLower()<br />
If filnam.Equals("iexplore") Then<br />
browser = ie<br />
End If<br />
<br />
Dim check As Boolean = True<br />
Dim i As Integer<br />
<br />
If Current_IE_Handles.Count > 0 Then<br />
For i = 0 To Current_IE_Handles.Count - 1<br />
If Current_IE_Handles(i).ToString.Equals(browser.HWND.ToString) Then<br />
check = False<br />
End If<br />
Next<br />
End If<br />
<br />
If check = True Then<br />
<br />
Me.Current_IE_Handles.Add(browser.HWND.ToString())<br />
'ListBox1.Items.Add(browser.HWND.ToString())<br />
MsgBox(browser.HWND.ToString())<br />
<br />
End If<br />
Next<br />
End Sub<br />
End Class
This code is to view all the current open IE handles.
the problem occur when de comment the 'ListBox1.Items.Add(browser.HWND.ToString())'. If I have got 3 IE open, I can only
get one handle. Does anyone know why 'Listbox1.Items.Add(browser.HWND.ToString())' stop my code keep running?
Help+
|
|
|
|
|
I can't tell what this code is doing because of the judicious use of "global" variables. Your logic needs to some work as this is just too much code for an event handler that has nothing to do with handling the WindowRegistered event. You're probably wondering why I just said that.
Easy. This code doesn't belong in an event handler. It belongs in it's own Sub or Function, and at quick glance, could be broken into 2 or 3 other subs/functions. Though, from your description of what it should be doing, this is too much code just to show a list of window handles.
This code is executing a large block of code when an event fires. It's not doing anything with the event or the data itself. The event is just being treated as a trigger to execute some code. A simple timer would do the exact same thing.
Normally, you'd take the data coming in from an event argument and setup a call to a method that takes the data, validates it, the processes it.
Private Sub shellWindows_WindowRegistered(ByVal lCookie As Integer) Handles shellWindows.WindowRegistered
UpdateWindowHandleListBox()
End Sub
Private Sub UpdateWindowHandleListBox()
ListBox1.Items.Clear()
' I have no idea what "shellWindows" is here:
For Each ie As SHDocVw.InternetExplorer In shellWindows
If Path.GetFileNameWithoutExtension(ie.FullName).ToLower().Equals("iexplore") Then
ListBox1.Items.Add(browser.HWND.ToString())
End If
Next
End Sub
Like I said, I have no idea what these other "global" variables are, what types they are, what you're using them for, WHY you're using them, ... So this code is going to be very simple compared to what you've shown.
|
|
|
|
|
can we select the area on windows application form through mouse at run time.
please help
Piyush Vardhan Singh
|
|
|
|
|
You found the right forum then ?
Select it for what ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes u can take a snapshot of the screen or a particular window... or some part of it...
|
|
|
|
|
thanks for reply
exactly i want this. have u any link or help file.
Piyush Vardhan Singh
|
|
|
|
|
OK, in that case, you should work on asking questions more clearly. Obviously, this other guy understood you, but I sure didn't. If you look at the Screens class, it gives you access to all the screens on your system, PrimaryScreen is what you need on a single monitor system. Then you need to work out the bits of your form you want, where they are in screen co-ordinates, and you can just copy it. There are articles on this site on screen capture, you should try searching the site, too.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can indeed write code to do that. But is that what the OP is asking ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i had done this . i take screen shot through window. but i want to change the style to take screen shot. for this i open window in Maximized ,invisible and without border mode after that i select that area through mouse (which part i want to take screen shot) and after that i want to take screen shot.
Piyush Vardhan Singh
|
|
|
|
|
|
I must import an excel in openoffice because openoffice is free and all the customers have this program.
Any documentation about this subject would be welcome.
thanks
|
|
|
|
|
How does this relate to VB ? You want to open an Excel program in open office ? Doesn't it do that already ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to export a file csv in a openoffice in vb.net.
thanks.
|
|
|
|
|
I very much doubt that openoffice supports control through code the way that office does. I may be wrong, you should check their site for info.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As a long-time VB6 programmer, I have made frequent use of the following function ...
Private Function VBDesignEnvironment() As Boolean
On Error Resume Next
Debug.Print 1 / 0
If Err Then VBDesignEnvironment = True
On Error GoTo 0
End Function
... to allow the setting up of test-conditions, etc, in apps under development. This function guaranteed to return True when operating with the IDE, but False otherwise.
This provides a useful safeguard should one forget to remove the test code before release (don't ask!).
Now, this technique does not work within the VB.Net IDE, unfortunately.
Does anyone have any similar, guaranteed-to-work function to determine if the code is running in the IDE?
Jeff Law
New Zealand
|
|
|
|
|
|
Thank you Christian!
That works a treat
Jeff Law
New Zealand
|
|
|
|
|
In DatagridView , is possible to set as datasource 2 or more related tables from a dataset ?
And more , to use a Sum of a field as datagridview column ?
For illustration i have 2 tables in my dataset:
Table 1 : St_ID (primary key ) , Name
Table 2 : MID ( Primary Key) , Student (related with ST_ID) , QTy , Date
in table 2 for a student there are 1 or multiple registration with different QTY and Date.
Now i want to display in datagridview 2 columns : Name Sum(QTY)
But i don't want to query directly the database , but i want to use only tables in dataset.
Thank you !
|
|
|
|
|
The DataSet class doesn't have a Select method to allow you to do this easily.
If your DataSet, which is a collection of DataTable and DataRelation objects, has those relationship objects in it, you can build your own table by enumerating the Name records in the "Table1" table, and lookup up the keys in the "Table2" table. You'd be able to interate over those records to build the Sum you want, then just add the Name and Sum to the DataTable you're building.
Or, you can simplify this greatly by having the database do it and just hand to you table, just like the SELECT commands you executed to get these tables in the first place.
|
|
|
|
|
I have an existing windows application that I wrote in C# that needs information from an existing legacy application (no code available).
The legacy application can hand off 4 pieces of information to an ActiveX exe. I have written this in VB6 and the information arrives and is displayed in a message box without problems.
My question is, how do I get the information from the activex exe into the existing C# application? Do I use an event? If so, how do I set that up in the vb app and then how do I recognize that the event fired in the C# app?
|
|
|
|
|
TimNaber wrote: The legacy application can hand off 4 pieces of information to an ActiveX exe. I have written this in VB6 and the information arrives and is displayed in a message box without problems.
And that method would be _______________ ???
TimNaber wrote: My question is, how do I get the information from the activex exe into the existing C# application? Do I use an event? If so, how do I set that up in the vb app and then how do I recognize that the event fired in the C# app?
It's done the same way. If the legacy app fires an event that VB6 handles, you wire up an event handler in C#. But, without knowing anything about how this "legacy app" works, or if it's even a component, and not a real app, there's no way to tell you how to do this.
|
|
|
|