| Convert.ToDateTime (13 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi, I'm using Convert.ToDateTime to convert a string representation of a date in a TextBox. Here is what I'm doing: DateTime cvDate; cvDate Convert.ToDateTime(textbox.Text); This works fine if there is data in the text box, but fails if there is not data in the text. So I want to check for the presence of data in the text box before I do the conversion. So I check for the length of the textbox val... |
|
| How to disable browser caching (11 replies) |
| ASPFriends.com 'aspngcs' list |
| I am running into this rather easy looking problem. Any help is appreciated. Website has 2 pages, ViewPhoto.aspx, UpdatePhoto.aspx ViewPhoto.aspx is the start page, which display a photo and Has a link to UpdatePhoto.aspx UpdatePhoto.aspx , has file upload code, and after successfully uploading Redirects to ViewPhoto.aspx page. The newly uploaded image actually replaces the previous one (so they h... |
|
| why is "this" read-only? (3 replies, VIP) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspfreeforall] to [aspngcs] by Marcie Jones marciejones@yahoo.com Why do I get the error "cannot assign to ' this ' because it is read only? How can I make it non read only or what is the problem here: class DataMenu : DataTable { public DataMenu() { DataSet ds new DataSet(); SqlDataAdapter da new SqlDataAdapter(); SqlConnection con new SqlConnection(ConfigurationSettings.AppSettings["... |
|
| datatype for SQL Guid question (5 replies) |
| ASPFriends.com 'aspngcs' list |
| I tried: System.Data.SqlTypes.SqlGuid o "5E08246E 39C9 11D5 A9DA 00B0D0202075"; but got compile error: Cannot convert type String to 'System.Data.SystemTypes.SqlGuid' Thanks, Francesco |
|
| IsNumeric in C# (6 replies) |
| ASPFriends.com 'aspngcs' list |
| Hello What is the most direct method of determining whether or not a string is a numeric value? What about other data types. I've been doing it with try catch blocks and the Convert object. Is there a better way? Regards Eric |
|
| How to define multiple indexers for single class or struct (that is two or more arrays) (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngdatagridrepeaterdatalist] to [aspngcs] by Tim Tim.Musschoot@rug.ac.be To define an indexer to a struct or class we do the following : public struct MyStruct { public string []data; public string this[int index] { get {return data[index];} set {data[index] value;} } public void click(Object sender, EventArgs e) { MyStruct ms new MyStruct(); ms.data new string[5]; ms[0] "Hello"; ...... |
|
| what datatype to use for a SQL GUID? (3 replies) |
| ASPFriends.com 'aspngcs' list |
| What C# data type should I use for a SQL GUID? Thanks, Francesco |
|
| Defining and using structures within class (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngdatagridrepeaterdatalist] to [aspngcs] by Victor Von Doom doctordoom@aspelite.com Hi All : Is this the best method by which I can define and used structures within classes. The way I do it this way is that I want to modularise my code by restricting access to this data structure to users of this class. Is there another way to do it ??? Should I initialise the class beforehand or i... |
|
| Defing an Enum in C# (5 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngfreeforall] to [aspngcs] by Victor Von Doom doctordoom@aspelite.com We're stumped. We'd like to create an enumeration like MS does with SqlOleDbType but for cursor types (in this case). We would like to be able to write this: Public CursorType Cursor { set {m cursorType value;} get {return m cursorType;} } Where CursorType is defined as: enum CursorType : int { wait 1, arrow 2, cr... |
|
| cnt = ( cnt + 1 ) % 15 (5 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi, there, in C#, if cnt 1; what is "cnt ( cnt 1 ) % 15", I meaned, in the following method. private void time1 Tick(object sender, EventArgs e) { cnt ( cnt 1 ) % 15; } Thanks. |
|
| Adding Dynamic Events to a CheckBox (5 replies) |
| ASPFriends.com 'aspngcs' list |
| I am trying to generate numerous checkboxes on a page and wire them all up to one function. Here is the code I use to create the CheckBoxes. When I uncomment the line of code for the Init Event that fires when the Checkbox is created, but the CheckedChanged Event does not fire off. What am I missing? private CheckBox GetDeleteBox(string tableid) { tempCK new CheckBox(); tempCK.ID "Delete " tableid... |
|
| Integer to Hex (5 replies) |
| ASPFriends.com 'aspngcs' list |
| is there anything in C# that is equivalent to VB.NET Hex() function that converts from an integer, long, short, byte to a string representing the hex equivalent of that number? Wally |
|
| Breaking out of foreach loop (4 replies) |
| ASPFriends.com 'aspngcs' list |
| How does exit a foreach loop? Similar to an 'End For' in VB? thanks |
|
| Get object by Id (5 replies) |
| ASPFriends.com 'aspngcs' list |
| I have the Id of an object(a DropDownList web control) as a string of course and I want to get the object based on this Id. Is there a way to do this in C#? |
|
| COM Port Communications (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Does anyone have an alternative to SerialStream.cs that would allow communications with a COM port. More importantly a modem. Jaison Green Hunt Interactive 425*746*7880 |
|
| combine compare statements (7 replies) |
| ASPFriends.com 'aspngcs' list |
| How would I write the following line in a more neat way? if ( myDataType "int" || myDataType "smallint" ) something like this pseudocode: if ( myDataType ("int" || "smallint") ) Thanks, Yannick Smits |
|
| Does anybody know how to write this code in C# (4 replies) |
| ASPFriends.com 'aspngcs' list |
| Does anybody know how to write this code in C# % Response.Buffer True Dim objXMLHTTP, xml 'Create & initialize the XMLHTTP object Set xml Server.CreateObject("Microsoft.XMLHTTP") sRemoteURL "https://www.eProcessingNetwork.Com/cgi bin/tdbe/transact.pl" 'Open the connection to the remote server xml.Open "POST", sRemoteURL, False 'Send the request to the eProcessingNetwork Transparent Database Engine... |
|
| Dynamic Multidimensional Array in C# (3 replies) |
| ASPFriends.com 'aspngcs' list |
| Copied from [aspngfreeforall] to [aspngcs] by Terri Morton tmorton@macdirect.com Hi I want dynamic multidimensional array in C#. In VB.Net its very easy to manage from "ReDim Preserve". How could I define dynamic multidimensional array in C#?. Thanx Sohail |
|
| Sniff Platform with C# (4 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngclient] to [aspngcs] by Yannick Smits dotnet@stepcompany.com I am trying to do this: if (Request.Browser.Platform "Win") { //Do Something } And have it recognize anything with win in it. Same with Mac... How can I perform this Instring type function? Thanks. |
|
| anyone have any sample c# code to determine a sql server's resources? (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Using a c# windows application, I need to only run a set of stored procedures on a sql server 2000 database if the sql server has enough resources to run it, meaning 1) ample memory 2) ample cpu 3) ample Latch time... 4) etc... Anyone have any sample c# code that can point me in the direction of querying these resources for there database server? |
|
| Good Tutorial (4 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngfreeforall] to [aspngcs] by Tim Musschoot Tim.musschoot@rug.ac.be [Please do not re direct to another list, thanks] I've asked this before, but someone re direct my Q to a list that I did not subscribe. And he did not reply for my request to sccop up those responses. Could you guys re sent your replies please? Thanks Q: Any good site for C#.Net tutorials for a beginner? Join the w... |
|
| Collection of Objects (4 replies) |
| ASPFriends.com 'aspngcs' list |
| I have two objects, let's say person and address. I want to allow person objects to have multiple addresses. What is the best way to accomplish this? I would think to create a collection of address objects that is exposed as a property of the person object. I'm thinking something like the following: Person Person null; Address Address null; Person new Person(); Person.Name "John Doe"; Person.Birth... |
|
| Namespace issues (7 replies) |
| ASPFriends.com 'aspngcs' list |
| I seem to remember asking this question before but cannot recall if I got a response ;) I have two namespaces: Mamanze.CodeFormatter ASPAlliance.Mamanze.Samples Now the second is the active namespace for the class in question. Problem is that when I try to do: Mamanze.CodeFormatter.SomeClass It cannot find the reference because it sees Mamanze as a sub name of ASPAlliance. Putting a using statemen... |
|
| Java / JScript (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi all, Can someone tell me about the Javascript/JScript's usage?. I am using C# in ASP.NET to develop a web application. Do i need to use JScript to make this application browser independent?. Your feedback will help me to develop application properly, Regards, Venkat TIL, Tel: 91 4562356/583/585/588 92,4567622 24,4567626 34 Fax: 91 4567635/4562584 Original Message From: Joshua Perry Jperry@1800c... |
|
| quick watch vs stepping over code... (3 replies) |
| ASPFriends.com 'aspngcs' list |
| just a quick test app to see a very misleading difference in the quick watch/watch list vs actually stepping/running the code double mydbl System.Double.NaN; if(mydbl System.Double.NaN)mydbl 500; Console.WriteLine(mydbl); the watch determines: name value type (mydbl System.Double.NaN) true bool but actually stepping into it will never evaluate to true if(mydbl System.Double.NaN) and it will never ... |
|
| Version Info in c# assembly (3 replies) |
| ASPFriends.com 'aspngcs' list |
| Does anyone know if it is possible to get access to the assembly version from code within that assembly? Thx, Fergal Moore |
|
| Retrieving multiple settings from a cookie (3 replies) |
| ASPFriends.com 'aspngcs' list |
| I think that I am going mad here. I have no problems setting a cookie value and then retrieving it. I can also set multiple values to a cookie without any problems. However I cannot get my head around retrieving multiple values from a cookie. Any chance of someone providing some sample code? Also, with Classic ASP one could set the domain name for the cookie so that it was only accessible from tha... |
|
| reflection/assembly/file dependancies... (4 replies) |
| ASPFriends.com 'aspngcs' list |
| here's the situation: im generating proxy assemblies from web service @ runtime i have a custom class which holds this actual assembly, among other things i serialize this custom class to my database then i deserailize, and everything is fine. I then delete the actual .DLL from my app's bin directory for just the generated proxy class then i again attempt to deserialize, and it throws an error. ca... |
|
| Trying to use a code behind... (2 replies, VIP) |
| ASPFriends.com 'aspngcs' list |
| the code behind page references namespaces in a .net dll. Asp.Net chokes on the using statement. I know that I need to somehow reference the dll in the code behind page but am not sure how to do so. If anyone could help out it would be appreciated thanks. |
|
| Char.IsNumber() (4 replies) |
| ASPFriends.com 'aspngcs' list |
| I remember a thread a while back asking about IsNumeric in C#. The Char type (something I never really need to use unless parsing for a Split()) exposes a static method IsNumber(); So I think the best way to approach the IsNumeric might be something like this. public bool IsNumeric { foreach(System.Char c in System.String.ToCharArray()) { if(!Char.IsNumber(c)) return false; } return true; } Paul D... |
|
| Daylight Saving Time Problems (9 replies) |
| ASPFriends.com 'aspngcs' list |
| I have an ASP.net (C#) application that provides access to certain functionality at a set time of day. The application checks reads the time from a field in the database and then if that time has passed it provides users with access to the functionality. This all works fine, except that it is one hour out which I suspect is because it is/isn't taking into account daylight saving. I'm using DateTim... |
|
| Why text box is not clear (5 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi group Sorry for my stupic question below I put one button and one text box into a form of an ASP.NET page. Thay are all web control. I deleberately set EnableViewState of the text box to false. The content of the text has nothing. In the code behind of the correspoinding class I set the text property of the text control to something like "Yamaha Toyota OShama Bin Laden" only when the page is no... |
|
| Can enums be extened? (6 replies) |
| ASPFriends.com 'aspngcs' list |
| Greetings! Can enums be extended? E.g., can I add a static method to a custom enum? Thanks, Remas http://www.aspalliance.com/remas |
|
| System.DirectoryServices Some Properties... (3 replies) |
| ASPFriends.com 'aspngcs' list |
| I have a System.DirectoryServices.DirectoryEntry , a "User". i can enumerate READ all of its properties, including: RasPermissions 1 UserFlags 513 MaxStorage 1 PasswordAge 1 PasswordExpired 0 LoginHours System.Byte[] FullName testtestusername Description testuserdescription BadPasswordAttempts 0 HomeDirectory LoginScript Profile HomeDirDrive Parameters PrimaryGroupID 513 MinPasswordLength 0 MaxPas... |
|
| Decode ViewState? (4 replies) |
| ASPFriends.com 'aspngcs' list |
| Is it possible to decode ViewState info? I have an error handler that displays all the ServerVariables and includes ViewState info if there is any. I just want to know if I can use it or not. Cheers, Julian Voelcker The Virtual World (UK) Limited Cirencester, United Kingdom |
|
| Renaming a file (3 replies) |
| ASPFriends.com 'aspngcs' list |
| I am trying to figure out the best way to rename a file in c#. There doesn't seem to be a File.Rename method or anything close to that. The only method I can find that might work is File.Move(oldname,newname). Is this the only way to do it? thanks Michael |
|
| Hourly Check? (13 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi All, I need to run a background service that checks a config file on the hour to see if any site management emails need to be send. If there are it mails them out. How and where would I hook up the timing code? Any pointers or suggestions welcome TIA |
|
| Passing C# strings by reference to a COM object (8 replies) |
| ASPFriends.com 'aspngcs' list |
| I am in the process of wrapping a legacy COM object in C# classes to simplify integration with .NET. One of the methods on the object requires three strings to be passed by reference, so that data can be returned. The call is of the form... oCOMThingy.AuthorizeEx (ref object vrt1); According to the docs, the call was designed so that it would work with VB Script variants, when passed by reference.... |
|
| OO class design question (3 replies) |
| ASPFriends.com 'aspngcs' list |
| I am building an OO Business Logic Tier in C# for a big .NET application, a community web site, ala Yahoo and MSN (but not quite that big). A core object is the Member class, representing a signed in Member of the site. When the Member object detects a sign in, it loads some data for a user that is used in a Control Panel type region, with live statistics. As users click on links for details about... |
|
| Scope of the variable in ASP.NET Page (4 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi, I have a Webform with two text boxes and one button "Next". The following is the Code behind class for my webform. Whenever the pages loads (for the first time), I open a connection to the database, execute an sql statement and store the result in a DataReader Object. Also, I read the first record and display it in the text boxes. Now the problem occures is when I press the Next Button. Logica... |
|
| Random Number Question (15 replies) |
| ASPFriends.com 'aspngcs' list |
| I am working with a Random number and I noticed that the "Next" method does not generate the max number. So "RandomNumber.Next(0,2);" will only generate 0 and 1. Any ideas? Here is the code %@ Page Language "C#"% script runat "Server" public void Page Load(Object sender, EventArgs e) { Random RandomNumber new Random(); int i RandomNumber.Next(0,2); Display.Text i.ToString(); } /script !DOCTYPE HTM... |
|
| I am trying to convert my VB script to C# here are the line that are the culprit (3 replies, VIP) |
| ASPFriends.com 'aspngcs' list |
| I am trying to convert my VB script to C# here are the line that are the culprit // in VB the failing line was like this // Dim parameterSearch As SqlParameter New SqlParameter("@Search", SqlDbType.NVarChar, 255) parameterSearch SqlParameter New SqlParameter("@Search", SqlDbType.NVarChar, 255) parameterSearch.Value Request.Params("txtSearch"); myCommand.Parameters.Add(parameterPortalID); Descripti... |
|
| SSL (6 replies) |
| ASPFriends.com 'aspngcs' list |
| What do we need to do in order to make HTTP requests over SSL? I can easily do normal HTTP, but I get the following error when i use HTTPS: System.Net.WebException: The underlying connection was closed: Could not establish trust relationship with remote server. Thanks. Robert Chartier Author and Developer 604 975 5590 rob@aspfree.com http://www.aspalliance.com/nothingmn/ |
|
| Cast to ascii and back. (3 replies) |
| ASPFriends.com 'aspngcs' list |
| Hello, How do I cast a character to it's ascii equivilant? And then cast it back? iA (asc)"A"; //? iZ int.Parse("Z"); //? sA (char)iA; //? sZ (char)iZ; //? Thanks, Stewart Haddock |
|
| Err: "Input string was not in a correct format" (3 replies, VIP) |
| ASPFriends.com 'aspngcs' list |
| I am getting the following error on the code below: "System.FormatException: Input string was not in a correct format." This method has no imput parameters, so I am flummoxed. Any ideas? code: RandomString RanStr new RandomString(); lblRandomString.Text RanStr.Create(); Thanks, Stewart Haddock |
|
| enum oddity... (4 replies) |
| ASPFriends.com 'aspngcs' list |
| MessageI can declare an enum like the following: enum MyEnums {ENUM1 1, ENUM2, ENUM3, ENUM23 23, ENUM24}; ... // Somewhere else in a method... for (MyEnums l enum MyEnums.ENUM1; l enum MyEnums.ENUM24; l enum ) { Console.WriteLine("l enum {0}", l enum); } Now, having come from a C POV, that wouldn't even compile because performing an increment on an enum is illegal. But, C# allows that to happen. W... |
|
| Slow Execution ? (14 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi ... I'm just getting started with some REALLY simple C# workouts ... "Hello World" stuff ... compile is fine but the execution is SLOW ... I experienced the same thing fooling around with Win VB.NET simple apps I'm talking about .EXE console apps here ... when I do the same things in ASP.NET exec is fast after the first page request/compile ... any thoughts out there ? thanks ... |
|
| C# File Includes (13 replies) |
| ASPFriends.com 'aspngcs' list |
| I have a few files with constants that I want included in my web applications. How Do I include files in C#? Greg Bernhardt Forum Admin http://www.physicsforums.com |
|
| Collection Serialization to XML (3 replies) |
| ASPFriends.com 'aspngcs' list |
| Hi! I'm trying to serialize an object which contains a collection. this is the code of the object Persona. public class Persona { ... . [XmlAttribute("Nombre")] public string Nombre { get {return m Nombre ;} set {m Nombre value;} } [XmlElement(typeof(Email))] I don't know what to put here public Emails Emails { get {return m Emails;} set {m Emails value;} } } The Emails collection is defined like ... |
|
| Referencing Application State in C# (2 replies) |
| ASPFriends.com 'aspngcs' list |
| Moved from [aspngdata] to [aspngcs] by Tony Stark IronMan@aspelite.com How do I reference an Application State variable from a class? This is what I am trying but I get an error on the HttpContext line. using System; using System.Web; class MyClass { public string MyMethod() { string str HttpContext.Current Application.Get ("MyAppStateVar").ToString(); ... } } The error I get is 'Object reference ... |
|