Answer Questions
Tess_H Small programm how to write it
how to write programm as follow : the input : AABATTRSSR The output : ABTRS the program delete the repeated item . please help me Oh this is fun.... Here you go: string removeDup( string s) { int index = 0; while (index < s.Length-1) { s = s.Substring(0,index+1) + s.Substring(index+1).Replace(s[index].ToString(), "" ); index++; } return s; } Uuh, I see, I did not understand the requirement correctly ;) Well, if the order of the characters is not important, then this will do, but I am not a regex expert, so I cannot flip it arround... but be assured, there is a regular expression which can do this ;) string text = "AAAAABATTTTTRSSR" ...Show All
Edward1 How to link other *.cs files
Is it possiable for me to include a .cs file in to another file.. what Im tring to do is.. on one file I have created a namespace, and I want to call this namespace on another .cs file, is it possiable Also I'm new to c# only been coding in it for a week. Thanx :) Thanx guys what I did was.. csc /target:blah.dll blah.cs and that created the dll then I compiled the dll together with the .exe file So, I assume that you are compiling by running CSC fromm a command line. In that case, to compile two source files into one asembly, the syntax would be just (I believe) CSC bob.cs jim.cs /other /options /here Include another .cs file in your project or referenciate another .cs file from your current .cs file Yo ...Show All
Alvin Kuiper How to Store Passwords in the Code
Hello Everyone, I have a username and password which I want to use to access some stuff but If I disassemble the .exe I cant see the UserName and Password.... What is the best way to hide it within the code..... Thanks, Harsimrat Sure, DESEncryption http://www.thecodebehind.com/code/dotnet/csharp/c-encryption-and-decryption.aspx encrypting and decrypting a file: http://www.codeproject.com/csharp/FileEncryptDecrypt.asp http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnnetsec/html/SecNetHT10.asp hope it helps! your post tells me (it maybe a typing error ) That you cannot see the username/password but you don't want it to If you are s ...Show All
SamuraiJack How to write Urdu on C# Controls
How can i write Urdu on C# Controls(e.g. Button, TextBox, Treeview, etc.). In urdu there are multiple glyphs for every characters. Different glyphs of a character are used depending upon the position of the character in the word. Its Urgent.... Plz Reply as soon as possible... Hi, please follow the below steps to achieve the same. 1. Change your forms language property to Urdu. 2. And text property to your urdu text. 3. Save project and compile. 4. Now change your regional settings language to Urdu. 5. Run the application. You will see urdu text. thank you, bhanu. azeezi wrote: Thanks, Actually i have to write urdu on the controls, dynamically. But when ...Show All
praveench2k how to convert int to float
Hi all, I have two variable, count and totalcount, both are integer My result is declared as float, When I perform result = count/totalcount; it did not return a float as it should be. Instead, it return 0 (eg 5/25) How can I convert it to float Thanks Matthew Watson wrote: That won't work Rizawan... totalCount/count will still be calculated in integer precision. The correct answer is: float result = count / (float)totalCount; Sorry Matthew, You are right I just took the quesiton wrong as you can assume from my answer above. Best Regards, Rizwan aka RizwanSharp Insead of type conversion of Variables u can simly use function Convert.ToFloat(a/b) ...Show All
Shughes FileNotFound Exception when trying to invoke compiled Assembly
Hi! I'm making an application that requires loaded scripts, and for this, I'm using the CodeDom namespace to write my own compiler. The problem I'm having is that when I try to invoke methods from the compiled assemblies, I get a FileNotFound Exception with a constant path (my windows temp directory) that ends in a dll name that changes for every build. The line I get the error on is this one: <source>object Instance = Results[Counter].CompiledAssembly.CreateInstance( ExtractFilename( TempScript.Name ) );</source> My classes for compiling and loading script files looks as follows: <source> using System; using System.Collections.Generic; using System.Text; using System.I ...Show All
SuperArmySolder Dynamic Property Page creation - web app in c#
Hi, I am new to dotNet, i am developing a sample application, ASP.Net WebApplication 2005 and the coding part i am doing in C#. In the Default.aspx i would like to create a Property Sheet, And number of pages(tabs) in this property sheet should be dynamic. User enters a value say 4 then 4 Pages should be in the Created when submit button is cliked. I would to know how can solve this problem. What i have in mind is have a System.Windows.Controls.TabControl() then add items to it in a loop. How can it be implement as a web control using C# Any code snippet,suggestion,Ideas ...... regards, Alex Hi Galin Iliev, Thank you for the reply, is this possible without using Ajax How wo ...Show All
laiseng Position of selected cell
How do i find the position ( not the index of row and cloumn)of selected cell in a dataviewgrid I need it to place a control over the grid. Thanks. Regards Alu thanks alot! :) Regards Alu According to whether you want the display area or the client area you use one of the following: 1. For the display area of the currently selected cell: Rectangle rec = grd.GetCellDisplayRectangle(grd.CurrentCell.ColumnIndex, grd.CurrentCell.RowIndex, false); the last argument, when true, returns only the displayed portion of the cell, when false, returns the whole cell. 2. For content (client) area of the cell: Rectangle rec = grd.CurrentCell.ContentBounds; In boh cases, you have a rectangle with the position and si ...Show All
R2ks Capturing Key Events
Hi, I have a form that I want to respond to some key events. On the form is also a numericUpDown. It seems that the numeric is picking off the key events so that the code that I want to run for some specific events is not happening. Any know of how to deal with this Thanks Much. Jeff Hi, setting form's KeyPreview property to True should do the trick. Also, you can prevent up/down keys ever get to the NumericUpDown control...: private void form1_KeyDown( object sender, KeyEventArgs e) { if (e.KeyCode == Keys .Up) { // Process a key here e.Handl ...Show All
Marius F Creating a Datatable from a ArrayList
I have a datatable and when i add the rows to it....I click my OK button when i click my OK button I add all the rows to an arraylist...then i loop thorough my arraylist and insert the values into my database.....How would one go about getting those values out of my database back into the arraylist and back into the datatable....I know how to put it in the database but i am kinda cloudy on how I would get it back out and into my datatable....any help with this i see thats better explanation. well the sqldataAdapter is used with connecting to and updating/filling results to/from the database, sql server. dataset/datatable is an in memory storage type object. it holds everything in memory until you close the app of course. yo ...Show All
Shrek.NET Auto Resize Form Controls when Screen resolution changes?
Well, what the title says. I have been doing my GUI in a 1600x1200 resolution, but when i took my project home to continue working on it, well it doesnt fit my Widescreen, nor my 19'incher. Is there a way to automatically resize the form i have been reading about anchoring but it seems they only work for forms maximize and minimize, not when im switching resolutions! Any help would be great. Thanks! Anchor and Dock will help only to resize controls on the form but not the form itself. But you need 2 things: 1) Resize your form according to the resolution. 2) Controls also need to be resized upon resizing the form. (This can be done with Anchor and Dock properties). To Re ...Show All
Tito Jermaine Problems in using System.Convert.ToDateTime(string) method. Please help me.
Hi all, I have a string s="10/29/2006" (in mm/dd/yyyy format) I want to convert this string into a datetime value. I used the method convert.ToDateTime(s) But I am getting the error "string was not recognised as a valid datetime". Please help me out. When converting string into date you should always use ParseExact method of DateTime class. it should be ok. have you tried to use TryParse in .NET 2.0 and see if it works DateTime theOutputResult = new DateTime(); if (DateTime.TryParse("string", out theOutputResult)) { //datetime parsed. value in "theOutputResult" } you coul ...Show All
Speedie How to insert a paragraph?
I'm very new to VS.NET C#. I'm creating a simple app. to launch a flash tutorial. In the form, how do I insert a paragraphc explaining what this app. is going to be I tried the Lable control but it does not give me multi-line option. What do I need to use Thanks! As ahmedilyas has suggested, for editing more text, you can use a TextBox with Multiline set to true. It will look like a label if you adjust the BorderStyle, BackgroundColor, and ReadOnly properties. The important part is that you use the Lines property of the TextBox, which opens up a full multiline editor. I got the lable control to work now. The AutoSize property need to be set to false. Aga ...Show All
Buffbuh override and out keyword
hello, I am learning c# and I am not sure if this is possible. If any one can help thanks :). I have a base class called vehicle and two derived classes car and lorry. in the vehicle class I would like to have a showDetails() method that returns 3 varribels using the out keyword. then in the derived classes i would like to override this method doing the same thing as the base class plus out putting an additonal two varibles in the case of the car class, and 3 in the case of the lorry class. so in the vehicle class I have: public virtual void ShowDetails(out string engineType, out string engineSize, out string registrationNumber) { engineType = base.GetEngineType() ...Show All
rnadella Regular Expression - Put into columns
Hi, I'm reading the following file, and I need to put hte values into columns, what's the best way to do that 1 EMAIL SECURITY APPLIANCE Incoming Mail Daily Summary 03 Feb 2007 00:00 to 03 Feb 2007 23:59 (GMT -0200) Incoming Mail Summary Message Category % Messages Stopped by Reputation Filtering 97.9% 102.5k Stopped as Invalid Recipients 0.0% 5 Spam Detected 0.0% 44 Virus Detected 0.0% 0 Stopped by Content Filter 1.5% 1,518 Total Threat Messages: 99.4% 104.0k Clean Messages 0.6% 598 Total Attempted Messages: ...Show All
