|
Currently Iam doing that only but then when Iam closing the main form ie
form2 then my application is not getting closed. ie I am required to go to
the close button from the VB menu to stop execution of the application.
I dont know how far u can understand what I mean to say !!
|
|
|
|
|
Now it sounds like your first form is a splash screen.
What ever form is your startup form CANNOT be closed unless you want your entire app to be closed with it. Your startup form does NOT have to be visible when you app starts. You can start your app with Form1.Visible=False and have it Form2.Show, Form3.Show, whatever... But! You have to keep track of which Forms are open in your main form (Form1) and determine when Form1 either shows itself to be closed or closes on its own.
RageInTheMachine9532
|
|
|
|
|
I think there is a problem with your design assumptions and how Windows Forms apps work. It would appears that you think your application can stay open so long as there is ANY form in your app open:
Application
|
|
+-------+-------+-------+-------+
| | | | |
Form1 Form2 Form3 Form4 Form5
This is just not the case. Your application depends on a main class, or Form, that is the central hub of your application. Something like this:
Application
|
Form1
|
+-------+-------+-------+-------+
| | | | |
Form2 Form3 Form4 Form5 Form6
| |
Form7 Form8
Only when Form1 is closed can your application close, and in opposite terms, only so long as Form1 is open, even if its not visible, can your app stay open.
In the latter example, Form2 can be your splash screen, Forms 3-6 can be options dialogs, editors, print previews, subsections of your app, whatever, ... But in all cases, Form1 MUST keep track of which forms are open and closed.
RageInTheMachine9532
|
|
|
|
|
Thanks ,, Thanks a lot ..
My doubt is completely cleared...
Thanks for explaining it so nicely ...
Now I will implement this in my application.
If I have any doubts later then again I will write back.
|
|
|
|
|
Does anyone know how to show method or property descriptions for a particular class in Visual Studio's code-view? I do the following but it doesn't work:
Imports System.ComponentModel
Public Class JobSeeker
...
<Description("asdfasdf asdf asdf asdf")> _
Shared Sub delete(ByVal Name As String)
...
End Sub
End class
I want to be able to see the descriptions of my own methods when I'm calling them.
Microsoft says the description will show (if you use DescriptionAttribute) when you CLICK on the property, my guess is this is only for visual components, because in code-view you don't click on properties...
any ideas guys? your input will be greatly appreciated.
Regards,
Mesrop
|
|
|
|
|
the DescriptionAttribute is just shown in the propertywindow( at the lower border). i think you like to see the description by intelisense...so if you know how to do this let me know
|
|
|
|
|
You need a 3rd party extension to Visual Studio for this to work. VB.NET can't output the XML file needed for Intellisense to show you the description. Currently, i don't know of any extension that will do this for VB. The C++ and C# compilers WILL do this though.
The Description attribute only work in the properties window...
RageInTheMachine9532
|
|
|
|
|
another blow to VB, they claim C# does nothing VB doesn't, apparently that's not the case...
|
|
|
|
|
|
I'm not sure powertoys are the way to go, doesn't the 3rd party need to have the same powertoy to be able to see the descriptions? what if I want to ship user friendly marketable components, so when the developers program, they can see description tags for each method, just like they expect to. I know it's not a language issue, but yet what this means is those who program in C# can create quality components, whereas we can't... If there is 1 limitation, you can bet there will be more.
|
|
|
|
|
Mesrop Simonian wrote:
doesn't the 3rd party need to have the same powertoy to be able to see the descriptions
No, because all it does is generate the XML that the standard tools need. All it does is plug the gap for VB.NET
Mesrop Simonian wrote:
those who program in C# can create quality components, whereas we can't...
Do VB Programmers traditionally write components anyway?
VB (and VB.NET) is a productivity language before all else, and this usually means gluing together existing bits to solve a specific problem more than writing new components. So it's not a big issue for me at all, and with the powertoy, it isn't an issue at all.
I'm comfortable with VB.NET as a productivity tool (much more so than C#), and if I really need to ramp up performance or do something really tricky, I'll break out the C++ tools and use those.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Actually, from a language point of view, they DO do everything. This is just an output from the compiler that isn't supported...yet! Wait 'til the 2004 version...
RageInTheMachine9532
|
|
|
|
|
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
|
|
|
|