|
I don't think there is a general answer to the question.
You need to think about what the class/sub should do if an exception occurs.
Can MyClass do anything meaningful to recover from the exception? If it can then it probably should handle it, if not then don't catch it. (You might want to catch it so you can add additional info to the message and then re-throw the exception.)
If you catch the exception in MyClass what will GetXml do? It won't know the exception happened (unless you re-throw it). The same is true in MyClass if GetXmlFromServer catches the exception.
This will tell you if you actually need exception handling and where it should happen.
You should not use the exception handling mechanism to control program flow, but I'm sure you will see lots of examples where this does happen.
Regards
David R
|
|
|
|
|
Can MyClass do anything meaningful to recover from the exception? If it can then it probably should handle it, if not then don't catch it. (You might want to catch it so you can add additional info to the message and then re-throw the exception.)
Another question to ask is whether the caller is more likely to want to keep on with what it's doing despite the exception, or whether it will want to break out of any loop it's in. Personally I would think that in many situations the right approach would be to have routines take an error-function delegate which could throw an exception, silently swallow the error, or do something else. The try/do pattern isn't bad, but it provides no mechanism for distinguishing different types of failures nor for resolving them proactively.
Also, note that most of the time when you catch an exception and rethrow it, you should either use the word "throw" without an argument (if you don't want to change the exception type), or you should make a new exception that contains the original one as an InnerException.
|
|
|
|
|
I have a windows service coded in vb.net running.This service is controlling several devices simultaneously.Now i want to add another device to the system.How is it possible to do this without stopping the service or changing the code?Can it be done dynamically?
|
|
|
|
|
You're going to have to change the code anyway, just to add this kind of support to your service.
Your service will have to have some kind of interface to allow either polling some file or registry location to see if there are changes that need to be made, or, you can have another application send changes to the running service through Windows Communication Foundation or .NET Remoting (.NET 1.x).
Basically, if you didn't write this feature into your existing service, you're going to have to rewrite the code for the service. There is no "magic" ability of services that does this for you.
|
|
|
|
|
How do I list more than one item in a list box - by adding or inserting.
I am completely new to programing.
steve moorley
|
|
|
|
|
for i=0 to 10<br />
listbox1.Items.Add i<br />
<br />
Next
|
|
|
|
|
I have this vb project i did before with crystal reports and sql activex controls and now it keeps giving me errors when compiling it again
Can anybody compile it for me and tells me what steps did he make
and send me the compiled version of the project and the steps
Thanks
http://rapidshare.com/files/193910312/DONIA_SYSTEM_SRC.rar[^]
and please It's important to me point out the error and have a compiled version
just send me the comiled version via rapidshare link
|
|
|
|
|
Member 4216960 wrote: It's important to me point out the error and have a compiled version
Yes, I'm sure your bosses would expect you to be able to do this. What is it about your level of skill that is preventing you doing this yourself? A modern compiler will produce very helpful error messages pinpointing the source of every error. Read them, understand them, correct the errors and recompile. Repeat until done!
Alan.
|
|
|
|
|
well it would be easy if not i was lost in all these modules
i used to just include the crystal reports and sql dll libraries and ocx files
now i cann't remember NOTHING
it just needs some activex includes vbefore compiling
just download the source code and try to compile it ,Give it a try
|
|
|
|
|
That's not going to happen because whoever compiles this needs to have all of the control and libraries you're using (which you say you've used a ton of them) installed on their own machine in order to compile it.
|
|
|
|
|
just take a look at it it's not that big
try and tell me the steps to have the libraries missing
it's not that big
it's easy u have the source compile it and it will tell u what's missing
send me the compiled version and the steps u did
|
|
|
|
|
Again, that's not going to happen. I am not going to expose myself to a lawsuit because I looked at code that IS proprietary to the company you work for AND BELONGS TO THAT COMPANY.
Besides, this is only a single compile. What happens when you have to fix other bugs int he code and STILL can't get the code to compile??
|
|
|
|
|
How the fuck do these people get a contract anyways? Do you know what I would do if someone I contracted work to exposed the source code I was paying them to develop for me to the public? on rapidshare??
|
|
|
|
|
its my code
i developped that code
13 years agooooooooooooooooooooooooooooooooooooooooooooooo
My code
just i had a f***en virus destroyed me exe's
and so come on People
|
|
|
|
|
So what??
I'm still not going to take that chance.
And even less so now that you say you don't take precautions against viruses. You've pretty much guaranteed noone is going to touch any code you post.
|
|
|
|
|
thanx i just finished compiling it
the error was the sql database threads
i guess u r right
thanx for ur kind care
|
|
|
|
|
LOL, best post ever! But I will do this for you, it will cost you 550 British Pounds per day!
|
|
|
|
|
No one here will do your job for you. what company is going to be happy that you disclosed their entire application in it's source for others to look at?? You're exposing the entire business logic that people paid you to create????
|
|
|
|
|
hai friends,
I'm new to vb.net. i've Datagridcomboboxcolumn in my project. i want open the form at run time when i press F2 key on Datagridcomboboxcolumn then only form should appear . but Datagridcomboboxcolumn has no events to keydown,it has only disposed events for it. how can i raise the keydown events. anyone help to me.
Advance Thanks,
A.Gomathinayagam
|
|
|
|
|
Please don't post the same thread again
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
hai friends,
I'm new to vb.net, I've Datagridcomboboxcolumn in my project. i want open the form at run time when i press F2 key on Datagridcomboboxcolumn,then only it should appear. but Datagridcomboboxcolumn has no events for keydown,it has only disposed events. how can i raise the keydown events for Datagridcomboboxcolumn. anyone help to me.
Advance Thanks,
A.Gomathi nayagam
|
|
|
|
|
Maybe use the KeyDown event of the grid and then determine the current cell.
|
|
|
|
|
See Liqz reply.
Depending on the use of the form you want to load, you might want to reconsider the use of F2. If your form is for editing the content of the column, fair enough, but if that is not the case, consider a different key if possible. F2 is the standard key to use when editing the contents of a DataGridView cell.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
how to check whether the given data in the textbox control is valid , if valid the relevant details should be displayed?? can any one tell coding for this?? am doing this in vb.net using asp.net, a project which is a part of my course?? can any one help me... and am giving you the coding part... below, can anyone help me please...
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If (TextBox1.Text <> "") Then
Panel1.Visible = True
Panel2.Visible = True
Else
Panel1.Visible = False
Panel2.Visible = False
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<center>
<table>
<tr>
<td colspan="2">
<asp:Label ID="Label2" runat="server" Height="4px" Text="Patient Details" Width="139px" Font-Bold="True" Font-Size="Larger"></asp:Label></td>
</tr>
<tr>
<td style="width: 114px">
<asp:Label ID="Label1" runat="server" Text="Patient Id"></asp:Label></td>
<td style="width: 100px">
<asp:TextBox ID="TextBox1" runat="server" Height="15px" Width="57px"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Button2" runat="server" Text="Display" OnClick="Button2_Click" /></td>
</tr>
<tr><td style="width: 114px"><asp:Panel ID="Panel1" Visible="false" runat="server" Height="176px" Width="185px" HorizontalAlign="Left" BorderColor="Cyan" >
Panel1<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<tr><td>
<asp:Label ID="Label3" runat="server" Text="Report Incident" Width="117px"></asp:Label></td>
<tr><td><asp:DropDownList ID="drop1" runat="server" Height="6px" Width="54px">
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList></td><br /><br /><br />
<center>
<asp:Button ID="Button1" runat="server" Text="Enter to Report" PostBackUrl="~/Rep Entry Screen.aspx" OnClick="Button1_Click" /> </center>
</asp:Panel>
</td>
<td style="width: 100px">
<asp:Panel ID="Panel2" Visible="false" runat="server" Height="176px" Width="185px" HorizontalAlign="Left" BorderColor="Cyan" >
<center>
Displayed Report Entry Scren</center><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><center>
</center></asp:Panel>
</td>
</tr>
</table>
</center>
</asp:Content>
|
|
|
|
|
You need to look into javascript.
The following link goes to a tutorial that will teach you how to do this:
http://www.w3schools.com/js/js_form_validation.asp[^]
The same website has a lot more tutorials and information that will come in handy when you .are developing web pages and web applications
P.S. Post your other questions concerning web development on the ASP.NET forum.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|