|
I was referring to it not auto-reformatting the code, a nice change.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I run across ideas that don't really require a lot of code and are usually just to test out small pieces of code. In fact, it's now getting to the point where I have almost 100 folders with different little mini-projects. How do you manage your smaller projects in VS.NET?
I don't even know what half of those old projects were for now, so I have to go back through and open them to find out what I was playing with. I'm trying to figure out a better way to organize them and to get them built quicker then open a new project for every little idea or play code project that I run across.
|
|
|
|
|
I keep a separate folder for each real project I do, and then a folder called 'My Code', where everything else goes. I name the projects clearly enough that if I don't know what it does, I probably don't need it, so I delete it. If I ever need it again, it's on a backup CD.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
In Visual Studio 2005 you can now create a project, modify it all you want, compile, and test all without saving. Forget having hundreds of scratch folders lying around! This is definitely a feature I'm looking forward to.
My suggestion: quite using Visual Studio for test code snippets. Almost everything I write for CodeProject - both for articles and for the forums - I use the command line compiler (csc.exe) and a text editor called ViM[^]. Makes it really easy to not have lots of project files and intermediate files lying around.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
How do you organize the code snippets once you have them working the way you want them to? I guess I'm lazy, and sick of messing with folders. I'm thinking about setting up some sort of database to store all my snippets. Folders just aren't cutting it.
|
|
|
|
|
Keep them? I don't typically keep them. I post them here on CodeProject and it keeps them.
I would recommend using something like SnippetCompiler[^], which is handy for code snippets and even organizes them. I personally am not crazy about it because it's much slower than me doing everything with cmd.exe, vim.exe, and csc.exe. That's just me, though.
I have used it and it was pretty nice besides the performance issue (the author tried to make the UI too spiffy with inefficient code (typically that he didn't write, so you can't blame him) for something so simple).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
Oh, and Visual Studio 2005 will also feature a snippet organizer, along with ways to make your snippets dynamic and include them into code, integrating them (if you implement your snippets a certain way) with variables, methods, etc. that are already present in your code.
You should take a look at Beta 1 of Visual Studio 2005 (formerly known as "VS Whidbey") at http://www.sliver.com/dotnet/SnippetCompiler[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
Oops! Guess I didn't replease my clipboard buffer like I thought. Thanks!
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
You were a big fan of EDLIN, weren't you? Maybe WordStar too?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ouch! WordStar was okay for the time, but was grossly superceeded by Office, definitely the most integrated as far as UI and features go. Why wouldn't I use that?
Never actually used EDLIN, but I can tell you I'm not the only one using VIM here. Others use Emacs. We fight. (not really) Believe it or not, Visual Studio isn't used a whole lot here. The shear magnitude of LOC and the complexity of the projects warrant it almost impossible. Now that's really just for certain things. Some projects (such as Business Solutions, I believe) do use Visual Studio.
There's just something about a fast, super-powerful, console-based (there's a GUI called gvim, too) text editor and command-line compiler that feels so pure, you know? No wizards or fancy do-it-all buttons that others seem to live off of.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I have a CIS lab project for this week and I am not sure which way I should write the project. The directions are below;
"Programming Assignment #3:
You have contracted with a small convenience store/gas station to inventory the 5 items that it sells besides gasoline. You are to keep track of the items in 6 parallel arrays. Store information on the five items using variables in your main() method.
Note: Please choose your own set of variables/names/data types. The itemCategory, itemCost and itemPrice are required. You can load the data into the structures at the time of declaration (either in main() or globally - above main()):
Example:
double[] itemCost={2.99, ...};
double[ ] itemPrice={4.50, ...};
String[ ] itemName={"Gummy Worms", ...};
double[ ] itemWeight={6.5, ...};
char[ ] itemCategory={'F', ...};
int[ ] itemCode={11200, ...};
Please come up with your own naming for the variables and your own (unique) data.Write a program that will generate report(s) showing all 5 items & allow the user to display individual inventory items.
Requirements:
Create a text menu using a switch() block, to ask for the item number (or some unique numeric identifier), or 0 for all of them, or 99 to exit. All other input will result in an error message."
Is this possible in C# as a console application or would I have more success as a windows application?
Any guidance is greatly appreciated.
Life is great, Just BREATHE!
|
|
|
|
|
Wow - what a terrible design. Your teacher is an idiot.
You can certainly do this as a console application, and doing so would free you from having to write GUI code.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
Wow - what a terrible design. Your teacher is an idiot.
5
|
|
|
|
|
It was a funny statement, but what's not funny is how often that's true!
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Since he's asking that you load the data in "main" or globally (which you would still have to do in "main" or in a callee), he most likely expects you to write a console application.
This is possible to do in C#, yes. I would recommend you take a look at the system.Convert class (to easily convert data types), the System.IO.FileStream and System.IO.StreamReader classes (if reading from a file), as well as the rest of the .NET Framework SDK.
For class projects (and we're typically pretty good about detecting them in this forum), you won't find all the answers - you won't learn anything that way. If you have specific questions regarding certain functionality, feel free to ask.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I need to get a highlighted text from a window (e.g IE) and put it in a textbox in my application.
I want to use a hot key combination (e.g Ctrl + 1) to move the text.
My hot key combination should function like Ctrl + C, but I don't want to get the text from the clipboard.
The code for the hotkey combination I know, but not how to get the highlighted text from a other window.
Is it anyone who know how to do this?
|
|
|
|
|
There is no universal way. Internet Explorer and other Microsoft COM servers (like Word) use a TextRange object. From Internet Explorer - if you have a reference to the current IHTMLDocument2 , you can create a TextRange by using IHTMLDocument2.selection to get an IHTMLSelectionObject , and if not null call IHTMLSelectionObject.createRange . The process is similar for Office products, but uses Office-specific objects to get a TextRange (a different class but works the same).
For text boxes and rich edit controls (encapsulates by the TextBox and RichTextBox controls, but are just Windows Common Controls classes "EDIT" and "RichEdit" (1.0), "RichEdit20A" (2.0; ANSI), or "RichEdit20W" (2.0; Unicode), you can P/Invoke SendMessage and pass EM_GETSEL (or EM_GETSELTEXT for Rich Edit controls - both work but work differently) to the control's HWND (exposed by the Control.Handle property inheritted by each control in Windows Forms).
If this is from another application to which you don't have a reference (or handle), P/Invoke FindWindow and/or FindWindowEx . This process has been discussed many times in this forum so click "Search comments" for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thanks for the answer.
Can you give me a example on how to P/Invoke SendMessage and pass EM_GETSEL?
|
|
|
|
|
I would recomend you search for "SendMessage" by clicking "Search comments" directly above this forum. We've covered it more times than I can count here, and there are plenty of examples found in articles on this site.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I'm sorry but I don't understand how to use the EM_GETSEL or the EM_GETSELTEXT. Can you point me in the right direction?
Here is my code so far:
private string gst(IntPtr hwnd)
{
IntPtr retValue;
StringBuilder strb = new StringBuilder(4096);
retValue = SendMessage(hwnd, EM_GETSELTEXT, (IntPtr)0, out strb);
return strb.ToString();
}
|
|
|
|
|
This may be an old topic but I'm having trouble finding any decent information on how to send SNMP traps using C#. Any help/links would be appreciated.
|
|
|
|
|
http://www.google.com/search?q=%22SNMP+traps%22+C%23[^]
Several of those results even point back to CodeProject. Click "Search comments" to search this forum (which isn't currently indexed by web crawlers).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I know this is a long time after the original thread, but i'm still a little lost on the subject......basically what i'm trying to do is make a computer act as an agent and generate traps, that's all.
Is it possible to do this using the winsnmp functions .ie. SnmpCreatePdu,SnmpSendMsg, etc?
Thanks
|
|
|
|