|
Sprawl posted:Well the user on that machine had permission to write to the registry i assume? is UAC on? The machine is very similar to the one I made the app on, and has admin privileges. I'm going to need to deploy it to machines without admin though, will that be a problem?
|
# ? Apr 19, 2010 23:03 |
|
|
# ? Apr 25, 2024 23:53 |
|
if I have a base class with 3 constructors like this:code:
code:
|
# ? Apr 20, 2010 02:40 |
|
wouldn't a partial class make more sense? or if they are classes can't you just inhert the class?
Sprawl fucked around with this message at 07:21 on Apr 20, 2010 |
# ? Apr 20, 2010 07:05 |
|
wwqd1123 posted:if I have a base class with 3 constructors like this: Yep, you'll have to write out any constructors you want to use. As far as I can tell VS doesn't have an auto-generate option either, although the new addition of optional parameters could cut down on the number of overloads you have to write. BizarroAzrael posted:The machine is very similar to the one I made the app on, and has admin privileges. I'm going to need to deploy it to machines without admin though, will that be a problem? Depends on which registry hive you're writing to, CurrentUser will work just fine, I'm not sure about AllUsers (or whatever it's called), the rest require admin privileges. dwazegek fucked around with this message at 08:31 on Apr 20, 2010 |
# ? Apr 20, 2010 08:28 |
|
Anyone have any experience with a NoSQL database like CouchDB or MongoDB? I'm working on a document-centric project (kinda ecm'ish), and it looks appealing. The caveat being that I'll need to store other information about the documents in a normal MSSQL db (e.g. viewing histories).
|
# ? Apr 20, 2010 08:55 |
|
I have a list of objects in C#, with each one storing the time it was created, which is checked periodically by a function, and the function removing the object from the list if it's too old. I've searched for an answer to this, but most examples of measuring elapsed time say to store a DateTime.Now.Ticks or whatever, and comparing it to another DateTime.Now, but I'm worried about that being thrown off if the user changes the system time during that period. Another option is Environment.TickCount, but that's only an int value which wraps around after a month or so, and my program could have uptimes larger than that. The best option I've seen is to use a StopWatch, but that class seems more geared towards measuring performance than for general use. In C, I would just store a clock_t and compare it with clock(), but I can't find an equivalent in C#. What's the best thing to do in this scenario?
|
# ? Apr 20, 2010 18:32 |
|
Does anyone know of a way to detect if a user is currently logged in through remote desktop? I'm working on a WPF application where I'd like to disable animations if the user's logged in through remote desktop(cause the animations look like crap).
|
# ? Apr 20, 2010 21:03 |
|
PhonyMcRingRing posted:Does anyone know of a way to detect if a user is currently logged in through remote desktop? I'm working on a WPF application where I'd like to disable animations if the user's logged in through remote desktop(cause the animations look like crap). C# syntax public static bool IsRemoteSession { get; } http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.isremotesession(VS.85).aspx
|
# ? Apr 20, 2010 21:19 |
|
Sprawl posted:C# syntax Ha! I love you, thanks!
|
# ? Apr 20, 2010 21:35 |
|
mantralord posted:I have a list of objects in C#, with each one storing the time it was created, which is checked periodically by a function, and the function removing the object from the list if it's too old. I've searched for an answer to this, but most examples of measuring elapsed time say to store a DateTime.Now.Ticks or whatever, and comparing it to another DateTime.Now, but I'm worried about that being thrown off if the user changes the system time during that period. Another option is Environment.TickCount, but that's only an int value which wraps around after a month or so, and my program could have uptimes larger than that. The best option I've seen is to use a StopWatch, but that class seems more geared towards measuring performance than for general use. In C, I would just store a clock_t and compare it with clock(), but I can't find an equivalent in C#. What's the best thing to do in this scenario? I think Stopwatch is your best option, it's designed for measuring elapsed time, and uses 64-bit counters. It doesn't have to be used for just profiling.
|
# ? Apr 21, 2010 10:22 |
|
This is going to be incredibly easy but Google returns information for MDI forms which (I don't think) isn't applicable to my problem. I have a master form. It creates a single note form on load, and the note can create more notes by calling the AddNote function of the parent. I'm having trouble setting Form1 as the parent though. When I try, I get the error: quote:Top-level control cannot be added to a control. I'm able to access the code of the "parent" so why can't I define it as the parent? code:
|
# ? Apr 21, 2010 20:44 |
|
Apparently you can't put a Form (a top-level control) on another Control, which makes sense. You probably want NewNote.Show(this), this sets the current form as the Owner of the form.
|
# ? Apr 21, 2010 21:06 |
|
dwazegek posted:Apparently you can't put a Form (a top-level control) on another Control, which makes sense. Ah, so forms in general can't be parents of other forms? How does that make sense? It's not self referential, the form1 that created a new instance of the frmNote form should be able to be the parent of the class it created, surely? Whats the distinction between ownership and parentage? Thank you. I set frmNote.Owner to Form1 and now I can do what I want (establish how many instances of frmNote there is) by using this.OwnedForms.
|
# ? Apr 21, 2010 21:28 |
|
Child controls actually lay on their parent and can never be drawn outside of the bounds of their parent. Owned forms can be drawn outside of their owner, they just always appear in front of their owner, and are hidden/closed with their owner. There's probably also a distinction at the underlying win32 HWND level, but I'm not familiar enough with that to comment.
|
# ? Apr 21, 2010 22:07 |
|
dwazegek posted:Child controls actually lay on their parent and can never be drawn outside of the bounds of their parent. Thanks a lot. In that case I'm glad I came for help as I want to be able to move the extra forms around the screen but the initial form will be really small.
|
# ? Apr 22, 2010 07:55 |
|
This is probably a really easy question, I just can't seem to wrap my head around this particular cast in C#code:
|
# ? Apr 23, 2010 00:34 |
|
Arms_Akimbo posted:Why does it still need to be cast as a string[]? Is there a simple explanation for this? The compiler doesn't have privileged information about the ToArray(typeof(string)) function. In particular, the compiler doesn't know that it will return a string[]. For all it knows, the function might even return an int[] ! We as humans know that the function will return a string[]. The cast in your code is the way that we can tell the compiler what we know. code:
|
# ? Apr 23, 2010 01:29 |
|
Ah ok, that makes a lot of sense. Thanks.
|
# ? Apr 23, 2010 02:31 |
|
Having a weird WPF problem. Different versions of windows have different themes in WPF. This causes some of my controls to be pushed out of a window in Vista that is appropriately sized in XP. What I'm trying to do is apply a template to each window that sets the values (font size seems to be the biggest culprit) in a consistent way over all versions of windows. So what I've done is opened expression blend and modified the template for a window. I had it add in a font size, and this is what I get in my app.xaml : code:
code:
This is all auto-gen code I'm using, so I'm really not sure what's going on here. Anyone else have this problem? edit: wow, that's some severe table-breaking. Added line breaks. IcedPee fucked around with this message at 15:45 on Apr 23, 2010 |
# ? Apr 23, 2010 15:39 |
|
Ir doesn't look like you even need to apply your template - your font size settings are in the default window style, not in the template itself, and the style loads the template you want automatically anyway. I think the whole thing doesn't work because the default style isn't applying automatically to your window since its the wrong type. Add this attribute in the root of the App.xaml file: code:
code:
code:
|
# ? Apr 23, 2010 20:18 |
|
Ok, that's fixed the problem, but it raises another one: I'd like to apply this same style to _all_ windows and not just MainWindow. What am I doing wrong? Edit: nevermind, I've got it now. I didn't see the part about the templates. IcedPee fucked around with this message at 20:41 on Apr 23, 2010 |
# ? Apr 23, 2010 20:36 |
|
IcedPee posted:Ok, that's fixed the problem, but it raises another one: I'd like to apply this same style to _all_ windows and not just MainWindow. What am I doing wrong? Ok then, put back the TargetType as it was before, and add code:
Then add code:
|
# ? Apr 23, 2010 20:44 |
|
I'm having trouble with arrays, lots of trouble. Like, been pulling my hair out for 6 hours trouble. For some reason I got the Alpha subprocedure to work, and the newCust to work ("work" in this case meaning not give me compiling errors, I wonder if they'll *actually* work) but the sub Search and printPerson are giving me a hard time. I would really appreciate if somebody could look over the following code and point me in the right direction. code:
thehandtruck fucked around with this message at 22:01 on Sep 12, 2011 |
# ? Apr 27, 2010 00:45 |
|
thehandtruck posted:I'm having trouble with arrays, lots of trouble. I would really appreciate if somebody could look over the following code and point me in the right direction. Well, here are some functions that will work: code:
code:
code:
ljw1004 fucked around with this message at 22:34 on Sep 12, 2011 |
# ? Apr 27, 2010 02:53 |
|
Anyone using Resharper 5 with Visual Studio 2010? I thought I'd give it a try again, and it immediately gets in my way on the very first line of code I write. I type List< and then the closing > is inserted after the cursor. Ok great, bracket completion- except that when I type > myself both of them stay (syntax error), and if i dont I have to skip over it using right-arrow or end key. How is that any more helpful than me just writing my own drat brackets? Am I missing something?
|
# ? Apr 27, 2010 04:29 |
|
I'm developing an app in c#, however this one is a bit more involved than what I've done in the past with the .net framework. It's a form based application, and by default it looks like every bit of information I've seen has the creation and navigation of multiple forms handled by the forms themselves. Is this really the standard practice, or is it just because the default code generated by the project wizards tends to lean in this direction?
|
# ? Apr 27, 2010 14:14 |
|
CRIP EATIN BREAD posted:I'm developing an app in c#, however this one is a bit more involved than what I've done in the past with the .net framework. It's a form based application, and by default it looks like every bit of information I've seen has the creation and navigation of multiple forms handled by the forms themselves. Is this really the standard practice, or is it just because the default code generated by the project wizards tends to lean in this direction? Sweet merciful crap do not do your application that way.
|
# ? Apr 27, 2010 15:24 |
|
ray2k posted:Anyone using Resharper 5 with Visual Studio 2010? I thought I'd give it a try again, and it immediately gets in my way on the very first line of code I write. I type List< and then the closing > is inserted after the cursor. Ok great, bracket completion- except that when I type > myself both of them stay (syntax error), and if i dont I have to skip over it using right-arrow or end key. How is that any more helpful than me just writing my own drat brackets? Am I missing something? I ended up turning all that crap off. It seems like they need to do some polish. Also it would be nice if it was easier to turn some of that stuff on and off easier and if they didn't just automatically change everything the second after you installed it. For instance after I installed it it started indenting all my curly brackets really far even after I turned off a bunch of features. I had to go in and uncheck 3 boxes that were spread throughout the options screens after googling the problem. And here all I wanted was a good testrunner for NUnit.
|
# ? Apr 27, 2010 16:09 |
|
thehandtruck posted:Notice how I had to comment out some 'Call' lines because they wouldn't compile. I've tried every combination and even looked at my previous programs but it doesn't to work. I can declare it, but then it screws up the Cust array. What a mess. Those call lines you commented out appear to refer to methods that don't exist in the sample you provided. If they do exist, then what kind of compile errors are you encountering?
|
# ? Apr 27, 2010 16:12 |
|
Begby posted:And here all I wanted was a good testrunner for NUnit. Pretty much what I was looking for, the only other thing being 'move type to file'. I'm really not getting all the resharper love the .net bloggers and MVPs seem to have.
|
# ? Apr 27, 2010 18:23 |
|
Dietrich posted:Sweet merciful crap do not do your application that way. Is there an accepted way to do this? I typically do web development, but I would be interested in what would be considered best practice here.
|
# ? Apr 27, 2010 19:35 |
|
edit: nevermind.
Fiend fucked around with this message at 18:00 on Apr 28, 2010 |
# ? Apr 27, 2010 20:52 |
|
I know the OP has a few books linked, but what which one(s) would you guys suggest for someone wanting to learn C# and is completely new to .NET but has a lot of C and Python experience? What about learning WPF?
|
# ? Apr 27, 2010 21:23 |
|
Begby posted:Those call lines you commented out appear to refer to methods that don't exist in the sample you provided. If they do exist, then what kind of compile errors are you encountering? Error 1 Value of type '1-dimensional array of Hotel.Form1.Customer' cannot be converted to '1-dimensional array of String' because 'Hotel.Form1.Customer' is not derived from 'String'. If I do code:
and if I add "Dim CustNames(60) as String" (to remove the error for the Call printArrays) I get the Format Exception: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. on line "lstDisplay.Items.Add(String.Format(fmtZone, CustNames(i)))" which is the main problem I'm having right now. thehandtruck fucked around with this message at 00:01 on Apr 28, 2010 |
# ? Apr 27, 2010 22:41 |
|
Dietrich posted:Sweet merciful crap do not do your application that way. I would never do that, but I'm trying to find a single example of how it should be done. I've created proper GUI application frameworks in C, C++, Flex, etc. but it seems the way that .net uses forms that it doesn't seem to be very easy to implement a decent application framework.
|
# ? Apr 28, 2010 18:52 |
|
thehandtruck posted:Error 1 Value of type '1-dimensional array of Hotel.Form1.Customer' cannot be converted to '1-dimensional array of String' because 'Hotel.Form1.Customer' is not derived from 'String'. Well, you didn't give us the definitions we need, but the error suggests it. I'm assuming printArrays looks something like this: code:
That means you either have to change PrintArrays so that it accepts an array of Customer, or you have to make build an array of String yourself to send to PrintArrays.
|
# ? Apr 28, 2010 19:17 |
|
Is there a bug in .NET 4.0's System.Diagnostics.Debugger.Launch()? If I don't attach a debugger, the process just quits, no exceptions, error messages or anything. In .NET 3.5 and below, the function just returns false and the process keeps on doing its merry little thing. There aren't any changes to the MSDN documentation and I don't see any changes in Reflector either.
|
# ? Apr 29, 2010 08:41 |
|
jarito posted:Is there an accepted way to do this? I typically do web development, but I would be interested in what would be considered best practice here. Create a singleton shell class that you can issue commands to- ie: Shell.OpenOrdersForm That way when you get all fancy with needing to make sure a form can only be opened once or with switching forms to an active window in order to prompt it's easy to do, and you can obfuscate the various form construction methods from other forms so that you only have to change things in one place.
|
# ? Apr 29, 2010 14:39 |
|
Can anyone recommend a decent book on learning C#?
|
# ? Apr 29, 2010 20:49 |
|
|
# ? Apr 25, 2024 23:53 |
|
Iron Squid posted:Can anyone recommend a decent book on learning C#? Look for the latest version of Jessee Liberty's Programming C#.
|
# ? Apr 29, 2010 21:33 |