|
Guffa wrote: Exit Sub
Yes, but what if the decision is to be made in a nested function?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Good point. You can only exit a thread like that from the main method running the thread.
If you are in a nested function you can either return a value from the function to indicate that the thread should be exited, or throw an exception (other than ThreadAbortedException) that you catch in the main method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I was afraid that was going to be the answer.
It would be easier having say Thread.CurrentThread.Exit(); but that
is not available...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I've put a sub main in my startup form, which I thought would be run on startup. But it doesn't seem to be. What am I doing wrong? Thanks
Public Class Form1
<stathread()> _
Shared Sub Main()
Console.WriteLine("MAIN SUB IS REACHED")
Try
Application.EnableVisualStyles()
Application.Run(New Form1())
Catch ex As Exception
Console.WriteLine("Main sub Error")
End Try
End Sub
End Class
|
|
|
|
|
Put the Sub Main in a module rather than a form.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
I am developing an Application where I have to export some data to an Excell sheet. For this I have to invoke the Excell application and send the data to the excell sheet.
Can anybody suggest how can I invoke the Excell Application form VB.Net 2005 and how can I send data after Invoking the excell application.
Thanks in advance.
Sekhar
|
|
|
|
|
Take a look into the Microsoft Office Interop Library.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
|
Hello All,
I have added one macro and while running the same, i am getting the error saying that 'Error HRESULT E_FAIL has been returned from a call to a COM component'.
Help plz..
Thanks in advance..
Sabari
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
A macro in what ? What does it do ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The purpose of the macro is to connect to the internet site.
Any idea?
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
I still have no idea what sort of macro you're talking about, or how this relates to VB.NET programming.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I m sorry if my question was not relevent, In VS 2005, I have added my Block of code which will run as macro. The same is visible in the VS 2005 Macro-Explorer, But while running(Clicking on the Macro) only it has given the above mentioned Error.
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
Hello every one
I am working on a VB 2005 application which was originally a VB6 application and is converted to VB 2005 Express.
I tried using Microsoft FxCop to check the application, I am having following issues
- I was naming my objects with "_" in vb6 and all the objects which were created in VB6 are not showing any issues but all the objects created in VB.net 2005 were showing Breaking errors with very high Certainty
- I changed the name of Objects created in VB.net as per the naming convention of .net. Still I am getting a error asking to start the object prefix (lbl/frm/cmb…) with Upper case letters which is again against the naming convention of vb.net
- It is also having issues with the spellings of the object. Will that actually affect
- What about all the objects created in VB6, am I also supposed to change the naming convention of them also?
Can any one plz help me with this..
Regards
Nishkarsh
|
|
|
|
|
FXCop doesn't tell you your code is broken, only that it doesn't follow a standard that FXCop enforces. Why do you need to pass it ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how to call the data from other table? let say i want to generate a doc number that is in this format <yyyymmdd><custid><running no="">. i don't know how to call the value field run_no from table runNO. the doc no formula is
docNo = System.DateTime.Now.ToString("yyyyMMdd") + Kod.Text + "values from run_no (table runNO)"
rite now my docNo only have <20080216><brt50>... helppppppppp...
|
|
|
|
|
Perhaps if you could explain yourself a bit better ? Does table mean a SQL database ? You get data out of a table by querying it with SQL.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i'm doing a program using microsoft visual studio. each time i submit my data, it will generate a doc number that is in <yyyymmdd><custid><running number="">. My formula
docNo = System.DateTime.Now + kod + <running number="">. kod is the value from a text box. for running number, i have a function GetRunNo that will update a table in my sql database each time i submit a data. in the table there r 2 field that is run_no and date. Each time i click add button it will update the running number base on date, it will add the data in the database, and each data will have a doc number for our reference. how can i call the values in that table to put in the doc number?
|
|
|
|
|
I'm trying to add some generic analog and digital TV capabilities to a program, and I'm having some difficulties with DVB-T.
I'm using the MS Tuner Library, and the MS Video Control ActiveX, and am able to get correct image and audio for most cases... but I'm not able to find how to make an automatic scan function (already done this with the Analog TV but this one seems to be different), don't know how to get the provider and service name, and when I try to view one of the channels the msvidctl control doesn't show the image and crash, but the frequency, transport stream ID and service ID is correct.
Also, couldn't check how to select multiple languages so far (no programs with it right now), nor found anything regarding the Teletext display.
Any help?
|
|
|
|
|
I have a requirement to repeat a block of fields for each record in a dataset. This would be easlily done in VS 2005 ASP.Net with a DataGridView and a template column.
How is this done in Windows forms with VS 2005?? I had though that I could create a user control with the appropriate layout and add that to a list control of some sort...but there didn't seem to be any likely candidates.
Must one add the controls and do the data binding by hand?
Thanks for any help available.
|
|
|
|
|
Well I've discovered I still dont' know where to put a global try...catch block in vb.net. I figured it would go in the Mainform.mybaseload method but that doesn't seem to do it.
Thanks.
|
|
|
|
|
Hi again,
this is how it is done in C#:
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try {
Application.Run(new myMainForm());
} catch(Exception exc) {
log(exc.ToString());
}
}
}
The above code instantiates and executes the main form class.
For a regular Windows app, VB.NET seems not to rely on a Main() method, but directly
launches the startup object.
However I trust in a VB.NET module you could do exactly what the C# code does.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Can I disable my try..catch block handling while debugging? Thanks
|
|
|
|
|
Nope. It's part of your code. You'll have to comment it out before you start the debugger.
|
|
|
|
|
Too bad..that's why making too many of them makes it difficult to debug.
|
|
|
|