-
- Improve this singleton wrapper
by AJama
- 14 Replies
- Last post
by Peter Ritchie
- I want a singleton wrapper so that I can avoid the .instance.method call syntax.
I want calls like
SingletonWrapper .fn ();
instead of
Singleton.Instance().fn();
the code bellow is my first attempt but I think there must be a better way of doing it.
thanks
public class SingletonWrapper
{
public static string fn()
{
return Singleton .Insta
-
- How to find the folder or file path dynamically?
by Musafir
- 14 Replies
- Last post
by Musafir
- Hi..
I needed to access the folder name in which the user has selected. For this i tried the FileInfo method. This is the code i tried:
FileInfo fi1 = new FileInfo (path);
txtDocName.Text = fi1.Name;
But i need to get the path of the folder or file which the user selects. so here i cannot pass the path as static one. How to provide the folder or file path dynamically
-
- Difference between - 'static public' and 'public static'
by Tryst
- 14 Replies
- Last post
by ShellShock
- Hi all, I have noticed code here and there that put the static keyword in front of the method accessor, like, 'static public' is there a difference between 'public static' or are they the same Tryst
-
- Export as HTML File
by Landon Parks
- 1 Replies
- Last post
by stenorman2001
- Does anyone know what code I would use to export HTML code in a Rich Text Box into an HTML file I know in notepad you can simply go to "Save" and then you can save your file as whatever, but you have to add ".HTML" to the end, or it wont export as an HTML file. How do I tell my program to open the "Save Document" dialog for the Rich Text Box and have .HTML document as
-
- Using Universal Types
by tkrasinger
- 2 Replies
- Last post
by Chris Brandsma
- As rule of the Coding-Style-Guide and Naming & Coding Conventions, we only use Universal Types in our projects. The only problem occurs, when using the intellisense/auto complete. If you begin to write:
List < Int32 > = new
the IntelliSense will create the following:
List < Int32 > list = new List < int >();
Also if you have a Method like:
-
- From string to an object
by Shu Gao
- 2 Replies
- Last post
by Shu Gao
- Hi,
I'm writing a program to read XML which specify Windows form settings, and generate a Windows form on the screen.
For example, the XML may looks like:
< form AutoScroll = " true " BackColor = " White " ClientSize.Width = " 789 " ClientSize.Height = " 970 " FormBorderStyple = " FormBorderStyle.FixedSingle " Name = "
-
- How to Create a URL syntax checker in C#
by Pipz
- 14 Replies
- Last post
by Cminor
- I would like to create a URL syntax checker so that can verify a cerrtain URL not a phish site. But I am also aware that some URL have valid syntax but is still a phish site.
To answer this, I am looking for some measures on how to verify a URL and its correct DNS equivalent.
I am doing a project of mine as one of our requirements and I have decided to create a web browser (already done) and
-
- Visual C# Associating file types with programs
by Damion Chambers
- 3 Replies
- Last post
by Damion Chambers
- I would like to create an application that works similar to microsoft word or the other ms office suite applications. i.e. I would like to create and install my program so it can
1. Associate files i create with a particular extension to my program. 2. when i click on files with my extension they launch my program and open the data similar to a ms word document.
Iif anyone may be knowledge o
-
- How to execute a shortcut icon on a PC?
by ajm113
- 2 Replies
- Last post
by ajm113
- Hi, I want to execute a map editor, but since it will only work with a shortcut going to it I need my program to execute the shortcut. So whats the extension Is their a special way on doing this Also is their a way so I may open a program a speacial way in C# like a shortcut Thanks, Ajm113
-
- Sharing Serialization Data Between Assemblys.
by Lexxy
- 1 Replies
- Last post
by Lexxy
- Hey folks, My first post here on the MSDN forums, so, Hello! :) I'm developing a program (an "editor" of sorts) which stores its final data in a serialized file. The final data is a single serialized class which describes what my client program will use. Editor.EXE (outline) namespace MySharedData sealed class SharedData string SomeData void SaveToDisk() static SharedData LoadFro
-
- Combination console/form application
by eosjack
- 1 Replies
- Last post
by Peter Ritchie
- I have an existing console application that I want to extend with an optional GUI front end. I would like for this to all exist in a single executable rather than writing two separate versions (a console app and a windows app). If the user runs the executable normally, I want the application to run in a command window. If the user runs the executable with a specific parameter, say: program.exe -
-
- C# and c++
by Big Bill
- 6 Replies
- Last post
by Big Bill
- whats the differnce between c# and c++
-
- Whats the equivalent of __LINE__ and __FILE__ in C#
by SDX2000
- 8 Replies
- Last post
by micvos
- Whats the equivalent of __LINE__ and __FILE__ in C# I thought this hot-button issue would have been answered by now. But no one seems to have a good answer for this. I would love to see a solution which presents no runtime overhead. What about C# 3.0 does it address this issue
-
- how to convert int to float
by bslim
- 7 Replies
- Last post
by Matthew Watson
- 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
-
- Visual Question...
by Married Mark
- 2 Replies
- Last post
by Married Mark
- Okay... so I'm incredibly new to C#. I'm trying to print some numbers to the screen ranging from 1 to 100. Is there a way I can specify that each number printed shows in three digits. IE - 1 would print as 001 and 99 would print as 099. Thank you in advance for any assistance you can provide.
Married Mark
-
- Reading a txt file into 4 other files
by Carel Greaves
- 4 Replies
- Last post
by OmegaMan
- Hi
I am trying to create a small application that takes a flat file and seperates it into 4 files
The single flat file i have is not in any standard.
Example of the file
00|Jason|20070202|Grant|Smith|08432215423154|||||
01|Jack|0845647895245||
02||8412065078456||||
03|DanielX|Gafferson|Med1
I want to seperate all the records. If a record starts with 00,
-
- Help In Parsing a file
by UM-Prof
- 4 Replies
- Last post
by UM-Prof
- Hello, I am searching a text file using C# and I want to locate a word in the file...say for example apple
...when i find apple, i want to print out the whole line to a listbox
I tried String.Split() but I'm having lots of trouble...
an example of the text file...
The perfect apple should be crisp, delicious, and red with a slight hint of golden yellow.
For those with an
-
- Asynchronous reading while threads share common collection
by absg
- 8 Replies
- Last post
by Peter Ritchie
- I have 50,000 files on disk I need to read from, process the data, and insert into a priority queue. Doing this synchronously has been really slow, so am looking at a asynchronous solution.
I've looked at this previous thread for some guidance. I'm am really new to delegates/asynchronous I/O so I would appreciate any help. The code below doesn't seem to work, I've tried printing out the Thread.
-
- Error to get IThumbnailProvider object in c#, please help me!!
by Kavin Chen
- 6 Replies
- Last post
by Kavin Chen
- When I used IShellItem::BindToHandler method to get IThumbnailProvider object in c#, I got an error: System.AccessViolationExceptio n: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
My test environment: vs2005, c#, Windows Vista My code is: IShellItem pFileItem; Guid itemRiid = new Guid("43826d1e-e718-42ee-bc55 -a1e261c37bfe");
-
- COM and OLE in C#
by Azurewrath
- 4 Replies
- Last post
by Azurewrath
- Hi all, Anyone knows hot to accomplish something like this (at the bottom of the page (with video)): http://www.sloft.net Basically he is using javascript to talk to another program. The code is included in the zip packgage, but I still don't know how to do a similar thing, or find a similar command to connect to the program. I used photoshop's interop dlls and it was very easy. But with this th
-
- Get selected text form MS Office Word
by Mory0Tiki
- 5 Replies
- Last post
by Figo Fei - MSFT
- hi everyone, i want get selected text from ms office word. i use Ms AA 2 component but i dont get any thing . please give me solution.
-
- Accessing ASP.NET webservice on a remote machine
by akshah
- 7 Replies
- Last post
by Maheshbalaji
- I have created an Asp.net web-service and used an asp.net web application to access the service.
Everything works fine on my local machine when i access the application using localhost like:
http://localhost:2827/ConsumeService
But, when I try to access it through a remote machine using my IP like:
http://192.168.202.77:2827/ConsumeService
I m unable to access it.
Thnx in adv
-
- Reference to a property itself, not its value??
by AdamCKing
- 12 Replies
- Last post
by Peter Ritchie
- Hi
I am trying to work out an undo / redo scenario for my application. I have a roughly tree-shaped set of data and all the commands in my application generally modify or replace objects at points in this tree in a single way.
To this end I was intending to implement an undo item to be stored on my undo stack, which would hold a deep copy of the item prior to modification or replacem
-
- How to assign an explanation to a function in c#
by Kursat Konak
- 3 Replies
- Last post
by Kursat Konak
- Hello,
I have functions in my library, but their explanation isn't enough to understand by only looking at their signatures. Meaning
Like whenever you go over a DataAdapter.Fill() Method with your mouse, it will explain to you what that function does in 2-3 lines. But when you go over my function with your mouse it only tells you the signature. I want to learn how to add information for my
-
- Reading File from one Directory and Writing to Another Directory
by Uday321
- 4 Replies
- Last post
by Cameron Kloot
- Hi All, In C# I want to read a text files from one directory and perform some modifications on that txt file and i have to create another Directory with some name "New Directory" and write the file to this directory any help greatly appreciated.. Thanks, Uday.