Search Results

Search found 129 results on 6 pages for 'dotnetdev'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Resuming execution of code after exception is thrown and caught

    - by dotnetdev
    Hi, How is it possible to resume code execution after an exception is thrown? For exampel, take the following code: namespace ConsoleApplication1 { class Test { public void s() { throw new NotSupportedException(); string @class = "" ; Console.WriteLine(@class); Console.ReadLine(); } } class Program { static void Main(string[] args) { try { new Test().s(); } catch (ArgumentException x) { } catch (Exception ex) { } } } } After catching the exception when stepping through, the program will stop running. How can I still carry on execution? Thanks

    Read the article

  • How can serialisation/deserialisation improve performance?

    - by dotnetdev
    Hi, I heard an example at work of using serialization to serialise some values for a webpart (which come from class properties), as this improves performance (than I assume getting values/etting values from/to database). I know it is not possible to get an explanation of how performance in the scenario I speak of at work can be improved as there is not enough information, but is there any explanation of how serialization can generally improve performance? Thanks

    Read the article

  • Writing a string which contains " "

    - by dotnetdev
    I have a string from an xml document: <title type="html"> Is there a way for me to write this string like "<title type="html">"? I've had similar problems writing javascript as a string but I did see some solutions in the past (which I can't remember)? Thanks

    Read the article

  • Making sites on the fly, programatically

    - by dotnetdev
    Hi, Is it possible to create a site on demand? So in the response of an event, such as button click. I want users to be able to see one site (all users), but users with assigned to a certain group will see two sites. Also, when would I want to create a seperate web application? Thanks

    Read the article

  • Is problem solving of puzzles/logic tests a skill that can be developed with practise or only someth

    - by dotnetdev
    Programming is essentially problem solving/using a lot of logic. With solving puzzles (like the ones recruiters like MS etc ask), is this a skill that can be developed with practise or is it a skill that only someone who is gifted has (I assume the former as many people can pass these tests)? Even so, I keep thinking it is a special skill for someone gifted, not for someone with a lot of practise. I guess that with practise you are perhaps more open-minded and start to think out of the box more (solving technical problems in development may also foster this mindset perhaps). Thanks

    Read the article

  • Can't write text into textbox in ASP.NET web app

    - by dotnetdev
    Hi, I have an ASP.NET web application. In the codebehind for the .ascx page (which I embed as below), I attempt to write a string to a textbox in a method like this: Code for embedding control: Control ctrl = Page.LoadControl("/RackRecable.ascx"); PlaceHolder1.Controls.Add(ctrl); Method to make string for inserting into textbox: string AppendDetails() { StringBuilder sb = new StringBuilder(); sb.Append("msg" + " " + textbox1.Text etc etc ); return sb.ToString(); } Called as (in codebehind event handler for button click): this.TextBox4.Text = AppendDetails(); I call it by using ATextBox.Text = AppendDetails (in the button click event handler). The textbox TextBox4 is in the designer file so I am confused why the text does not get written into this textbox (it is readonly and enabled). When stepping through, the textbox4 control will successfully show the text I want it to display in quick watch but not in the actual page, it won't. Any ideas? Thanks

    Read the article

  • Breaking out of a nested loop

    - by dotnetdev
    If I have a for loop which is nested within another, how can I efficiently come out of both loops (inner and outer) in the quickest possible way? I don't want to have to use a boolean and then have to say go to another method, but rather just to execute the first line of code after the outer loop. What is a quick and nice way of going about this? Thanks

    Read the article

  • SQL Server service broker reporting as off when I have written a query to turn it on

    - by dotnetdev
    I have made a small ASP.NET website. It uses sqlcachedependency The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. Source Error: Line 12: System.Data.SqlClient.SqlDependency.Start(connString); This is the erroneous line in my global.asax. However, in sql server (2005), I enabled service broker like so (I connect and run the SQL Server service when I debug my site): ALTER DATABASE mynewdatabase SET ENABLE_BROKER with rollback immediate And this was successful. What am I missing? I am trying to use sql caching dependency and have followed all procedures. Thanks

    Read the article

  • Dataset holds a table called "Table", not the table I pass in?

    - by dotnetdev
    Hi, I have the code below: string SQL = "select * from " + TableName; using (DS = new DataSet()) using (SqlDataAdapter adapter = new SqlDataAdapter()) using (SqlConnection sqlconn = new SqlConnection(connectionStringBuilder.ToString())) using (SqlCommand objCommand = new SqlCommand(SQL, sqlconn)) { sqlconn.Open(); adapter.SelectCommand = objCommand; adapter.Fill(DS); } System.Windows.Forms.MessageBox.Show(DS.Tables[0].TableName); return DS; However, every time I run this code, the dataset (DS) is filled with one table called "Table". It does not represent the table name I pass in as the parameter TableName and this parameter does not get mutated so I don't know where the name Table comes from. I'd expect the table to be the same as the tableName parameter I pass in? Any idea why this is not so? EDIT: Important fact: This code needs to return a dataset because I use the dataRelation object in another method, which is dependent on this, and without using a dataset, that method throws an exception. The code for that method is: DataRelation PartToIntersection = new DataRelation("XYZ", this.LoadDataToTable(tableName).Tables[tableName].Columns[0], // Treating the PartStat table as the parent - .N this.LoadDataToTable("PartProducts").Tables["PartProducts"].Columns[0]); // 1 // PartsProducts (intersection) to ProductMaterial DataRelation ProductMaterialToIntersection = new DataRelation("", ds.Tables["ProductMaterial"].Columns[0], ds.Tables["PartsProducts"].Columns[1]); Thanks

    Read the article

  • Trouble with Action<T1, T2> and passing multiple parameters

    - by dotnetdev
    Hi, I have this code: s(x => x.Open()); s is a method which calls one parameter, which is perfectly fine, like so: public void s(Action<p1> action) {} Ignoring the naming conventions, if I make the method like the below: public void s(Action<p1, p2> action) {} How do I pass in more than one parameter? Out of interest, is there any way to use the params keyword with Action<? Also, I am using C# 4.0 so I would be interested to see how it can help me in an way. Thanks

    Read the article

  • Only one instance of a scriptmanager can exist on a page

    - by dotnetdev
    Hi, I design an ASP.NET web usercontrol and with a maskeditor and scriptmanager, I always get an object reference not set to an instance of an object exception at runtime. Stacktrace is: [InvalidOperationException: Only one instance of a ScriptManager can be added to the page.] System.Web.UI.ScriptManager.OnInit(EventArgs e) +384613 System.Web.UI.Control.InitRecursive(Control namingContainer) +333 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Control.InitRecursive(Control namingContainer) +210 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378 What causes this? Thanks

    Read the article

  • How exactly does dependency injection reduce coupling?

    - by dotnetdev
    Hi, I've done plenty of reading on Dependency Injection, but I have no idea, how does it actually reduce coupling? The analogy I have of DI is that all components are registered with a container, so theyre are like in a treasure chest. To get a component, you obviously register it first, but then you would have to interrogate the treasure chest (which is like a layer of indirection). Is this the right analogy? It doesn't make obvious how the "injection" happens, though (how would that fit in with this analogy?). Thanks

    Read the article

  • In a client-server relationship, should the server always rethrow the exception to the client?

    - by dotnetdev
    I have a set of web services (the server), and an app which consumes this (client). In this sort of relationship, should the server always throw exceptions (ie in the throw block, rethrow the caught exception), and the client catch this. Exceptions which the server can handle, it will deal with and not rethrow, but everything else will be thrown to the calling layer for further action (the consuming app can raise a msg box or whatever). Is this a good example of an exception that can be dealt with: A file cannot be written because the directory requires special privileges, so if this raises an exception, the file is written somewhere which does not require admin rights. Thanks

    Read the article

  • Questions on using enums as parameters and if/else conditions

    - by dotnetdev
    Hi, Is it possible to do the following with an enum in C#?: Pass in to a method a selected value of the enum (eg if an enum has members such as Red, Green, Orange, I can pass in Colors.Red). In the method body of the above method which accepts an enum, I can say if (Enum == Colors.Red). What would be the syntax for this? I've always seemed to have stalled on this.

    Read the article

  • Source cannot be found - step through disassembly

    - by dotnetdev
    Hi, I have an ASP.NET web app. I reference an external .dll, made by another team member. When first stepping through my code (which calls this dll's class and method), I get an error (runtime of course) stating that the source cannot be found and if I want to step through disassembly. What causes this? Also, is it possible to add .pdb files to a project's references? Thanks

    Read the article

  • Working with fields which can mutate or be new instances altogether

    - by dotnetdev
    Structs are usually used for immutable data, eg a phone number, which does not mutate, but instead you get a new one (eg the number 000 becoming 0001 would mean two seperate numbers). However, pieces of information like Name, a string, can either mutate (company abc changing its name to abcdef, or being given a new name like def). For fields like this, I assume they should reside in the mutable class and not an immutable structure? My way of structuring code is to have an immutable concept, like Address (any change is a new address completely), in a struct and then reference it from a class like Customer, since Customer always has an address. So I would put CompanyName, or Employer, in the class as it is mutable. But a name can either mutate and so be the same 1 instance, or a new name setup and while the company still owning the first name too. Would the correct pattern for assigning a new instance (eg a new company name but the old name still owned by the company) be?: string name = ""; string newName = new string(); newName = "new"; name = newName; And a mutation just the standard assignment pattern? Thanks

    Read the article

  • Developing a project which is an implementation of an open standard/protocol

    - by dotnetdev
    Hi, A lot of interesting code/projects are implementations of protocols, eg SNMP. How are projects like these, which depend on implementing a certain format, developed? Is the process something like get the guidelines of the protocol and then implement code which follows it. For example, XML-RPC is about transmitting XML docs between client/server, so the documentation on this protocol must outline the structure of the XML documents and then the way the transportation between client and server works, so the coder will implement this sort of functionality (xml doc construction, networking between the client and server). Projects I am thinking of (not to develop) are C# libraries which can interpret .PSDs, make VHDs, etc. So if I was to develop a C# app to implement .AI files (Illustrator files), what would be the steps I would look at (such as contacting Adobe, etc)? Is this the way such projects are developed?

    Read the article

  • Avoiding dependency carrying

    - by dotnetdev
    When coding, I often come across the following pattern: -A method calls another method (Fine), but the method being called/callee takes parameters, so in the wrapping method, I pass in parameters. Problem is, this dependency carrying can go on and on. How could I avoid this (any sample code appreciated)? Thanks

    Read the article

  • Question on preprocessor directives

    - by dotnetdev
    If I use proprocessor directives to define which code an OS will run, like so: #if winXP // Compiling for Windows XP platformName = "Microsoft Windows XP"; #elif win2000 // Compiling for Windows 2000 platformName = "Microsoft Windows 2000"; #elif win7 // Compiling for Windows 7 platformName = "Microsoft Windows 7"; #else // Unknown platform specified platformName = "Unknown"; How does the system pick up which OS is being used? This is an example from the book Visual C# 2010 Recipes, where the author says that the platformName variable (declaration ommitted), wil equal the OS above. Thanks

    Read the article

  • Different information domains in DB

    - by dotnetdev
    Hi, I have a database for my personal site and at the moment it is storing different domains of information (Eg cv, CMS schema, and more, all in one DB). I have noticed that sets of tables (eg all for one domain) have no relationship to other groups of tables as they are completely unrelated. What implication does this have on database design? I can assume this is a time I need to think about having 1 DB.

    Read the article

  • Exception wrapping and HTML pages

    - by dotnetdev
    Hi, We have a sharepoint 2007 project at work. The exception handling policy is to log to the Sharepoint logs. In this case, would the best approach be to call that method and then rethrow the exception higher up? Except if I rethrow it to be caught higher up, there is no other exception handling code so what would happen in this case? Also, if you are going to display a more friendly error to the user (which uses information in the exception object), then this would be a good use of exception wrapping. Would it be a good idea to make a custom aspx page and add these to customerrors, so that on init (not sure of the exact event), I can display exception info in the passed parameter on the page. However, a static html page can't do this so I don't see the point in wrapping exceptions (unless there is a page or alert which uses the exception object). So if a project uses html pages for errors, is there a point in wrapping exceptions? Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >