Hello. I uhh... I just want a sample code for the Exceptions: SecurityException and StackOverflowException. I'm still new to handling exceptions. Please, just a sample code that is about those two will do.

Member Avatar
Member Avatar
+0 forum 2

whats wrong with this code? It keeps giving me an "unreachable code detected " exception public static int search(string Registration) { // this method will search for registration, if found it will return the index value , else it will return max value + 1 for (int x = 0; x < numOfRowsCars; x++) { reg = ds1.Tables["tblCars"].Rows[x][2].ToString(); MessageBox.Show(reg); if (Registration == reg) { // Then return the index of the registration number return x; } else { // Then return the max index + 1 return numOfRowsCars; } } }

Member Avatar
Member Avatar
+0 forum 3

i am new to android. While i am running my application, it is running well in landscape mode, but in portrait mode, application is forcefully closed giving the following in log 05-31 16:48:30.958: W/KeyCharacterMap(428): No keyboard for id 0 05-31 16:48:30.958: W/KeyCharacterMap(428): Using default keymap: /system/usr/keychars/qwerty.kcm.bin 05-31 16:50:45.728: D/AndroidRuntime(484): Shutting down VM 05-31 16:50:45.728: W/dalvikvm(484): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 05-31 16:50:45.758: E/AndroidRuntime(484): FATAL EXCEPTION: main 05-31 16:50:45.758: E/AndroidRuntime(484): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kalmas/com.kalmas.Kalma2}: java.lang.NullPointerException 05-31 16:50:45.758: E/AndroidRuntime(484): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 05-31 16:50:45.758: E/AndroidRuntime(484): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 05-31 16:50:45.758: E/AndroidRuntime(484): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 05-31 16:50:45.758: E/AndroidRuntime(484): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 05-31 16:50:45.758: …

Member Avatar
Member Avatar
+0 forum 1

I’m creating a program that displays random lines from a file. I have 8 lines on my text file and after displaying the last/8th random line… it displays [B][I]Segmentation fault[/I][/B] and then terminates the program. The program should display a message saying that there are no lines left to display. Can someone help me with this? Or can somebody tell me how to display the 8 lines only? This is the function I made so far… [CODE]int easy() { vector<string> text_file; string quest; char choice; int line_counter = 1; srand(time(NULL)); ifstream myfile ("./questions/easy.txt"); cout << "Welcome to EASY level category!\n" …

Member Avatar
Member Avatar
+0 forum 5

Can anyone help me with this? or alter the code of mine when it comes to the user Input here's the block of code of mine [CODE]public int Remove(int i, Briefcase c[], String[] m) { int nChoice = 0; System.out.print("\tPlease remove " + i + " cases: "); nChoice = input.nextInt(); if (c[nChoice] == null) { System.out.println(); System.out .println("\tYou already entered that digit choose again\n"); Remove(i, c, m); } else { System.out.println("\tI'm " + m[nChoice] + " You just removed case # " + nChoice); System.out.println("\t|" + nChoice + "| contains $" + c[nChoice].getAmount() + "\n"); } return nChoice; }[/CODE] …

Member Avatar
Member Avatar
+0 forum 29

I'm having trouble figuring out how to use exceptions to check if a file stream was created successfully. I know I can use if statements, but how do I do this using try/catch statements? It compiles successfully but it gives me an error when I supply a non-existent filename as an argument. If I supply a file that does exist, it runs fine. The message I get when I give it a bogus filename is: [code] terminate called after throwing an instance of 'char*' Abort trap [/code] [code=cpp] #include <iostream> #include <fstream> #include <exception> int main(int argc, char *argv[]) { …

Member Avatar
Member Avatar
+0 forum 2

Hi Guys, I'm currently developing a project using WCF (hosted on local IIS) which connects to a local SQL database using LINQ to get data. My problem is that when I run the code, 9/10 times it'll fail with the "Specified Cast Is Not Valid" error, but the other 1/10 times it will return the correct value (a messagebox with the records 'name' field. The code snippets below are from my wcf datacontract/servicecontract, server and client code. There is only one record in the table im retrieving. WCF Service (IFaveoService.cs) [CODE][ServiceContract] [ServiceKnownType(typeof(SRType))] public interface IFaveoService { [OperationContract] IEnumerable<SRType> GetSRTypeByID(int srID); …

Member Avatar
Member Avatar
+0 forum 10

I am getting System.IndexOutOfRangeException everytime I try to compile my program. This is where the error is happening. [CODE] public static string findlinks2(string source) { char quotes = (char)34; //sets the char variable to quotes since you can't use it in a string normally string searchstring = (quotes + "fmt_url_map" + quotes + ":" + quotes); //sets the searchstring to "fmt_url_map": string[] fmt1 = System.Text.RegularExpressions.Regex.Split(source, searchstring); //splits html into 2 arrays string fmt2 = fmt1[1].ToString(); [/CODE] The error is occuring when is trys to assign the variable fmt2 the contents of fmt[1].ToString();. The error is obviously because the array fmt[1] …

Member Avatar
Member Avatar
+0 forum 2

I am writing a program that creates a file and attaches it to an email. I use a loop to create the attachment, send the email and then do it again with different information in the attachment. This works well for one tim through the loop, but on the second time through I get an error when I try to open the file for output to create the new version of the file. I get an unhandled exception of "The process cannot access the file 'c:\Project\Articles1\Article.txt' because it is being used by another process.". How can I release the file …

Member Avatar
Member Avatar
+0 forum 2

The End.