-
- Setting a value based on if condition
by Azurewrath
- 11 Replies
- Last post
by Azurewrath
- Is it possible to write this:
if (this.WindowState == FormWindowState.Normal) { Settings.Default.WindowSize = this.Size; } else { Settings.Default.WindowSize = this.RestoreBounds.Size; }
like this:
Settings.Default.WindowSize = if (this.WindowState == FormWindowState.Normal) this.Size; else this.RestoreBounds.Size;
If so, what's the cleanest way (as in i
-
- create a anonymous method from a string?
by Steve1999
- 10 Replies
- Last post
by IsshouFuuraibou
- Is it possible to build a delegate/anonymous method from a string public static List<T> Project<T>(List<T> list, Predicate<T> pred ) {...}
...
string dynamicCode = " delegate(Person p) { if (p.LastName == \"Neward\") return true; else return false; } "; Project<Person>(l, CreateDelegate (dynamicCode); So that the delegate can
-
- Running a C# Application Outside Windows Operating Systems - Is there a way?
by C&#35; Questionaire
- 8 Replies
- Last post
by C# Questionaire
- Hi, You may remember my first post ( Outa This Operating System ), previously posted. I asked for code to run outside Windows with C#. I was told that it can't be done with C#. I since have a solution to the big "no-no" and a new question. I have found out about apps that claim to convert .NET applications from .NET to non- .NET (like "Xenocode Starter Kit 2007" ). Therefore
-
- Find string in a string array
by Azurewrath
- 11 Replies
- Last post
by Hubert-Associates
- Hi all, I am trying to write a method that will find any exact string I want from a string array and return me the index of the first. Like if I have {"los angeles", "san diego", "seattle"}, and I want to find "san diego", it will return 1. Also I want it to go through elements till it finds a matching one, and then stops. I found a couple Find methods, but
-
- Running an external application to get the result
by ZopoStyle
- 5 Replies
- Last post
by ZopoStyle
- Hi,
I need to run an external application passing some parameters and then get all the results that this application print to the console...into a string...is there a way to do that
Can you give me an example
Thanks
-
- How do I convert the timestamp to actual DateTime?
by &#126;rabin
- 7 Replies
- Last post
by ~rabin
-
- Grouping files in solution explorer
by Eric Jensen
- 6 Replies
- Last post
by Gabriel Lozano-Moran
- Hi,
I have files in various subdirectories that I want to include in the Solution Explorer. It is getting a little tedious to "Add Existing Item" with a link (sometimes I click the button before changing it to "link" whereby I have to delete the copied file - bad UI design IMO). The files appear as a flat list in the explorer which is also a pain.
I've discovered I can use <CSFile Include
-
- Is there a C# and .NET reference for non morons?
by baldmountain
- 7 Replies
- Last post
by ShellShock
- Hi, Spent a good amount of time today browsing in Barnes & Noble for a decent reference to learn C# and the .NET framework. I don't think one exists. There are tons of those really fat books that have huge amounts of whitespace and chapters that are so simple that it is insulting to read. I've gotten to a point in my career where I buy the thinest book on a subject because the fat ones are jun
-
- Exposing Types Across Assemblies
by Adam Christopher
- 2 Replies
- Last post
by Adam Christopher
- I have a core library assembly that defines several enumerations. I also have a user control in a separate assembly; some of its methods require enumerations defined in the core library assembly as parameters. This user control is to be used in a VB6 application.
The problem I face is that I do not want to expose the core library to VB6 (I do have access to the source code, but it would be nice
-
- Converting a byte[] to datetime.value
by Turnsleft
- 6 Replies
- Last post
by TilakGopi
- My app is receiving data from an external application that I marshal into a structure that contains date and time arrays of type bytes
struct blah{
byte date ;
byte time ;
otherstuff.....}
I want to convert these into a datetime.value.
Can someone tell me the best method for doing this
-
- Creating a process through a windows service, but at a lower privelege?
by Predator14567
- 2 Replies
- Last post
by Predator14567
- Apparently I'm having problems with my service. Originally, I wanted to have a service change a HKEY_CURRENT_USER Registry Key, but seeing as you needed to call an API to do it, and I didn't know what to call, and with what parameters, I decided just to have the service run a windows application, and it would change the keys\values, because the service is running at local system, with Allow Servic
-
- Using the IS operator in a FOREACH loop
by Jet Jaguar
- 7 Replies
- Last post
by Axe22
- I am either not understanding how the IS operator works or how the FOREACH loop works.
I found some C# code that creates 1 object of 4 different derived classes (see code below). Those 4 objects are assigned to variables of an array of the "base class" type. A FOREACH is used to iterate the array. The FOREACH variable is the "base class" type also.
In the FOREACH loop, t
-
- event declaration
by papadi
- 11 Replies
- Last post
by Thomas Danecker
- Hi. I'm experienced in VB but new in C#. What's the ecquievelant of the following in C# Public Event MyEvent(arg1 as string , arg2 as int) Public Sub RaiseMyEvent() RaiseEvent MyEvent("bla bla",15) End Sub
-
- function profiler at vs2005
by stanley t.
- 1 Replies
- Last post
by Chris Brandsma
- hello,
in vs6 was a nice powerfull utility called : function profiler(the bulid->profile menu).
where can i found it in vs2005
thanks.
-
- When should I use A.D.A.M -vs- SQL?
by ChrisLaMont
- 3 Replies
- Last post
by timvw
- I'm a C# developer, and I'd like to store a large quantity of items in a database ofsome kind so I can do reporting on them. Each object will have a different number of columns, and there could easily be hundreds of thousands of these objects.
What are the right questions I should ask when it comes to deciding which database is right, SQL or ADAM SQL can store XML blobs, but ADAM is hiearc
-
- C# COM
by Azurewrath
- 12 Replies
- Last post
by Azurewrath
- Hi all, I am trying to do something that other python users are doing, but can't find how to do it in C#: >>> obj = win32com.client.Dispatch("MAX.Application.9") >>> obj._FlagAsMethod("loadmaxfile") >>> obj.loadmaxfile("C:\\test.max") Basically loadmaxfile is a function in the host app, which is registered like this: registerOLEInterface #
-
- Unique random numbers
by Lucy_H
- 14 Replies
- Last post
by Peter Ritchie
- Hi I have some code that generates a different random number in two textboxes:
Random random = new Random ();
int [] number = new int [48];
for ( int i = 0; i < number.Length; i++)
{
number = random.Next(1, 50);
}
for ( int i = 0; i < number.Length; i++)
{
textBox2.Text = number .ToString();
}
Random random2 = new Random ();
int
-
- "new"? Arguments when creating an object? (Help the beginner?)
by c_edward_b
- 4 Replies
- Last post
by decyclone
- I'm an absolute beginner, an occasional programmer with mostly non-C experience who downloaded C# Express yesterday and started trying to read lines from a text file. I think I'm confused about the "new" keyword and about what is the meaning of the stuff between the parentheses when creating an object.
The line below is from "Murach's C#" and creates a FileStream object so I
-
- Casting to interfaces
by Azurewrath
- 6 Replies
- Last post
by Azurewrath
- Hi all, What's the point of casting to interfaces, when you can invoke the members directly, like so: Box b = new Box(); b.Extrude(); b.Chamfer(); instead of: IEditable ed = b as IEditable; b.Extrude ( ); b.Chamfer ( ); Since intellisense shows me what I can access, I don't have to worry about using nonexisiting members Thanks, Aw
-
- How to find Network path from local path?
by mwalts
- 6 Replies
- Last post
by mwalts
- Hello again all, I might be using the wrong terminology so I'll give a quick example. I want to find the \\machinename\ShareName if one exists for a given local directory. i.e. if given C:\Folder on machine PK-234, and that folder is shared with a name of Folder, I would like to get \\PK-234\Folder Any help is much appreciated. Thanks, -mwalts
-
- Visual Studio 2005 - C# and .Net 2.0 , .Net 3.0 quickly tutorials
by OClaudiu
- 1 Replies
- Last post
by Christopher Fleming
- Hello. Where can I find quickly tutorials for Visual Studio 2005 - C# and .Net 2.0 , .Net 3.0 I have to learn quickly about them. Thanks' very much.
-
- Fail to Load dll from C# when no VS2005 installed
by Idit
- 4 Replies
- Last post
by Idit
- Hi, I am running C# application with a MFC dll on VS2005. When I copy the .exe file and the dll to another computer I get the following errer (both installed with .NET 2.0): An unhandled exception of type 'System.IO.FileNotFoundException' occurred in FilesUpdateApplication.exe
Additional information: Could not load file or assembly 'StrtData, Version=0.0.0.0, Culture=neutral, PublicKeyToken=nu
-
- Resolution of the [Design] window.
by Mark Tumilty
- 1 Replies
- Last post
by Jim Tomasko
- I am currently working on developing an application that is designed to run on a monitor that is running at a resolution of 1280 by 1024. Unfortunately the monitor I am developing the application on will only support that resolution at 60Hz, which I find painful to use, so I am developing it at a resolution of 1152 by 864. When I open the main form (size 1280 by 1024) in the C# IDE then the view i
-
- Found some odd behaviour with IO SetLength() & Write() using unbuffered IO
by Michael J. Brown
- 8 Replies
- Last post
by Michael J. Brown
- So here I am, trying to create a 32GB file and write some data near the end of it, thinking this is fairly optimized underneath. Apparently, if you use SetLength(32 * 1024 * 1024 * 1024), and seek near the end, all is good... until you try to Write to it. Once you begin your write, the file has to be filled up with some data as it's all empty space, which is semi-obvious. But it does this in 1K bl
-
- How To iterate Through array 2 dimension
by hemadotnet
- 14 Replies
- Last post
by hemadotnet
- how to eterate through array which have 2 dimensions from 0 to 255 and the result of looping must be array also 2 dimension the the first number is to represented number and the column the number represented how this number repeated in the array .... for example
[ 0 0 0 1 1 8 8 5 ]
[1 2 1 5 5 5 6 6 ]
the target array from this array must be as follow :
[0 3]
[1 2]
[8 2]
[5 1]