|
After a lot of pondering I finally decided to turn to my highest VB authority on this matter - Francesco Balena. Here's what he said for all those who asked me to keep them posted on this matter:
----
That feature is based on descriptions held in an XML file held in the same directory as the DLL containing the actual types and methods. To see what I mean, see all the DLLs and the pairing XML files in the C:\Windows\Microsoft.NET\Framework\v1.1.4322 folder
The guys that say that it can be done only with C# are partially right, because C# makes it _easier_ to generate the XML files that the Object Browser (and Intellisense) use to store descriptions of each methods. The C# compiler has an option that gathers all the comments interspersed in code (in a special format) and generates the XML file that VS.NET uses.
With VB you must generate this file manually. However, there is a tool at http://www.gotdotnet.com/team/vb/ that lets you do that with VB as well.
It is true (unfortunately) that C# can do things that VB can't - most notably, operator overloading, unsigned integers, and unsafe code - but this feature isn't one of those.
regards,
Francesco
|
|
|
|
|
I wrote a program (VB.Net) that takes the exiting file name, opens it, formats it and allowing the user to change/format the file and wait for the user to close the excel applilcation
but my WaitForExcelToClose function is not working..
Can someone please help me.
<br />
<br />
Dim wBooks As Excel.Workbooks<br />
Dim wBook As Excel.Workbook<br />
Dim sheets As Excel.Sheets<br />
<br />
excelApp = CreateObject("Excel.Application")<br />
wBooks = excelApp.Workbooks()<br />
wBook = wBooks.Open(filename)<br />
sheets = wBook.Worksheets<br />
' some other functions<br />
sheets.PrintPreview()<br />
WaitForExcelToClose()<br />
excelApp.Quit()<br />
<br />
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br />
Private Declare Function GetLastError Lib "kernel32" () As Long<br />
Private Declare Sub SetLastError Lib "kernel32" (ByVal dwErrCode As Long)<br />
Private Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, ByVal lpSource As Integer, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, ByVal Arguments As Long) As Long<br />
Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, ByVal lpdwProcessId As Long) As Long<br />
Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long<br />
Private Declare Function WaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long<br />
Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As Long<br />
<br />
<br />
Public Sub WaitForExcelToClose()<br />
<br />
Dim hWnd As Long<br />
Dim buf As String<br />
hWnd = FindWindow("XLMain", excelApp.Caption)<br />
If hWnd = 0 Then<br />
buf = Space(1024)<br />
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, GetLastError, LANG_NEUTRAL, buf, 200, 0&)<br />
Else<br />
Dim pid As Long = 0<br />
Dim lngThread As Long<br />
Dim lngReason As Long<br />
lngThread = GetWindowThreadProcessId(hWnd, pid)<br />
Dim lngProcess As Long<br />
lngProcess = OpenProcess(SYNCHRONIZE Or PROCESS_ALL_ACCESS, True, pid)<br />
lngReason = WaitForSingleObject(lngProcess, INFINITE)<br />
CloseHandle(lngProcess)<br />
End If<br />
End Sub<br />
thank you
|
|
|
|
|
Seems like alot of work for waiting for Excel to close. Could you declare the excelApp object WithEvents and then handle the WorkbookBeforeClose event?
RageInTheMachine9532
|
|
|
|
|
|
Possibly something like this:
Dim WithEvents appExcel As Microsoft.Office.Interop.Excel.Application
Private Sub appExcel_WorkbookBeforeClose(ByVal Wb As Microsoft.Office.Interop.Excel.Workbook, ByRef Cancel As Boolean) Handles appExcel.WorkbookBeforeClose
' do something here!
End Sub
I don't know if this is going to work the way you want, but...
RageInTheMachine9532
|
|
|
|
|
no but thank you for you help
|
|
|
|
|
Hi, Is there any way to get a programme written in Visual Basic .Net to work on a computer running Windows NT.
I'm trying to show a friend a programme I wrote but his computer runs Windows NT and my understanding is that Windows NT won't run a VB.Net programme...
If this is so is there any language which does run on Windows NT and any way to convert the Visual Basic.Net programme so that it would run?
|
|
|
|
|
All you have to do is install the redistributionalble portion of the .NET Framework. This is availble free on the Microsoft website.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
Sure. Make sure he's running Service Pack 6a and then install the .NET Framework available here[^].
RageInTheMachine9532
|
|
|
|
|
i use DrawRectangle to draw shapes in vb.net form..then i minimize the form and restore again, my rectangle is missing?!!!same happen to other type of shapes!! anyone can help me plz....
|
|
|
|
|
Have you heard the story of the "Boy who cried 'wolf'"? Of your six posts on this forum 4 have carried the word "Emergency" and 1 has used the word "Urgent".
Are they real emergencies? Will someone die if the answer is not found?
All I am asking is that you tone down this sort of language because people will become desensitised to it.
From my experience: Emergencies in software development are rare. Often if I get stuck on one part of a system I can post a question and move on to a different part. If/when someone replies I can go back and try their suggestion.
To your specific problem: Are you using DrawRectangle in the Paint event handler. The reason is that when any window is minimised or another window drawn on top then the contents of the window become damaged. The Operating System will not keep track of what is being drawn on the window, that is your job. If you draw with basic tools like DrawRectangle then you have to draw each time the window gets damaged. Normally when a window is damaged and needs to be redrawn Windows will issue a Paint event. You must handle this event and perform your drawing.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
i put emergency becoz i am doing my final yr project... i need the information as soon as possible due the time constraint of my project... if wat i done make u unhappy... then i apologize to u...
and thanks for ur reply...
|
|
|
|
|
Hi MJAY...
You will need to store the points you have used to create the rectangle in an array or a file..
Then in the paint event you will have to recreate all the objects drawn in that control..
Hope this Helps..
Thanks !
Manoj Madhavam
|
|
|
|
|
as topic, i can find DrawEllipse, DrawRectangle in picturebox control but i cant find DrawRoundRec in VB.Net !! anyone can help me plz...
this is the roundrectangle i mean...(of coz the lines must be connected each other)
____
(____)
|
|
|
|
|
That's because there isn't one. You're going to have to draw them yourself, line segment by line segment. You might want to look into GraphicsPath for creating an object that can be drawn all at once.
RageInTheMachine9532
|
|
|
|
|
Hi,
Here's a couple of functions I wrote that will draw you a rectangle with rounded corners. I just ripped them out of my own code, so I hope I didn't miss anything. Just call DrawRoundedRectangle and pass it your graphics object, a rectangle to draw in and an integer specifying how "round" you want the corners to be. If you have a program drop me a line.
' Draw an empty rectangle with rounded corners using the same pen for all sides
Public Sub DrawRoundedRectangle(ByRef prGraphics As Graphics, ByRef prPen As Pen, ByRef prRect As Rectangle, ByVal pvRounding As Integer)
Dim lrectSurface As GraphicsPath
lrectSurface = BuildRoundedRectangle(CreateRectangle(prRect.Left, prRect.Top, prRect.Width - 1, prRect.Height - 1), pvRounding)
prGraphics.DrawPath(prPen, lrectSurface)
End Sub
' Build a graphic path for a rounded rectangle/square
Public Function BuildRoundedRectangle(ByRef prRect As Rectangle, ByVal pvRounding As Integer) As GraphicsPath
Dim lPath As New GraphicsPath()
Dim lHalf As Integer = CInt(pvRounding / 2)
With prRect
lPath.StartFigure()
lPath.AddArc(.Left, .Top, pvRounding, pvRounding, 180, 90)
lPath.AddLine(.Left + lHalf, .Top, .Right - lHalf, .Top)
lPath.AddArc(.Right - pvRounding, .Top, pvRounding, pvRounding, 270, 90)
lPath.AddLine(.Right, .Top + lHalf, .Right, .Bottom - pvRounding)
lPath.AddArc(.Right - pvRounding, .Bottom - pvRounding, pvRounding, pvRounding, 0, 90)
lPath.AddLine(.Right - lHalf, .Bottom, .Left + lHalf, .Bottom)
lPath.AddArc(.Left, .Bottom - pvRounding, pvRounding, pvRounding, 90, 90)
lPath.AddLine(.Left, .Bottom - lHalf, .Left, .Top + lHalf)
lPath.CloseFigure()
End With
BuildRoundedRectangle = lPath
End Function
Nursey
|
|
|
|
|
thanks for replying me!!
i think i need ur program understand how the coding works, can u send to me?
my email is mjlai83@pd.jaring.my
thanks again for help!!
|
|
|
|
|
I have been writing a VB 6 program to execute dos commands with parameter eg :-
Commands1 = "pairdisplay -x umount " & DriveLetter & " " & VolumeName & " > d:\apps\shadowapp\logs\pairdisplay4.txt"
ExecCmd Commands1
Public Sub ExecCmd(ByVal cmdline As String, Optional ByVal HideWindow As Boolean = False)
' This sub executes the command in cmdline$ and waits for it to finish.
Dim proc As PROCESS_INFO
Dim start1 As STARTUPINFO
Dim ret&
If (HideWindow) Then
start1.dwFlags = STARTF_USESHOWWINDOW
start1.wShowWindows = SW_HIDE
End If
start1.cb = Len(start1)
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start1, proc)
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
When I try and execute this the execcmd gives an error stating that the file cannot be found.
Right now this does not work with the parameters and for the the pipe for the output (txt file), but the individual commands without the output etc do.
I am at a loss of how to get this to work. If anyone can help then i would really appreciate it.
Paul
|
|
|
|
|
Try adding the full path to pairdisplay before you pass it to ExecCmd:
Commands1 = "C:\Full\PathName\pairdisplay -x umount " & DriveLetter & " " & VolumeName & " > d:\apps\shadowapp\logs\pairdisplay4.txt"
RageInTheMachine9532
|
|
|
|
|
I want to make an image maipulation program and would like to know if anyone has any code that would be useful for image manipulation. Anything would be helpful...THANKS!!!;)
|
|
|
|
|
What kind of manipulation? There are volumes of books on various techniques for HUNDREDS of manipulations. Also, your going to have to be aware of pixel formats, color tables, transparency, ...
RageInTheMachine9532
|
|
|
|
|
I'd like to do some stuff with panels as the base to a range of user controls. What I'd like to do is, at design time, have a client area that is not comprised of the whole area of the user control. So, just like a form, I need a client area where the developer can place controls, and a non-client area where the developer can not put controls. Of course, moving a control in the client area clips it against the client area edges, so that controls can not be placed in the non-client area.
I've been looking briefly into the SetClientSizeCore stuff, but due to too many late nights I haven't been able to put much into my investigations. Has anybody here done such a thing.
An approach I tried a few weeks back was to put a scrollable panel inside a panel which didn't scroll. It was quite effective but lots of things happened that you don't want to, like the user being able to get outside the client area.
Any suggestions and pointers are much appreciated.
Nursey
|
|
|
|
|
Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count.
When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks!
|
|
|
|
|
hello,
why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..?
keep trying
|
|
|
|
|
Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records.
To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid.
And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.
|
|
|
|
|