Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. It may be worth explaining why you need to do this - if a function is expecting any derived class then it can only safetly call functionality from the base class, why do you need to create a new instance of this variable within the function? You could always create a new instance and have the variable type set to Base, but declaring the variable type on the fly will involve an awful lot of effort. If you want to create an instance on the fly the following should work - I'm not convinced that this is the best approach to your problem though... void CreateNewInstance(Base someObject) { Type t= someObject.GetType(); Base newObj =(Base) System.Activator.CreateInstance(t, true); }
  2. Easiest way is create an enum which contains the values you want to be able to assign to the property, then use this enum as the property type and things should work.
  3. Personally I find it very hard to learn from seeing answers laid out in front of me - I just loose interest too quickly. I find that the best way to pass the exams is to learn the product in question (how it works, how to use it correctly etc) - not only does that get you through the exams but you also gain useful skills in the process. Call me old fashioned ;)
  4. Generally speaking if the text is to be readonly and just for display purposes (i.e. no need to copy either) then labels would seem the obvious choice. If you may need to select the text or there could be a requirement for the data to be edited then use a textbox.
  5. You can pretty much take as long as you want to do the exams - I definately wouldn't like to do them all in one day (most I've ever done is 3 in one day and that was bad enough).
  6. The second one is just doing a simple string sort on the items (look at the 1st column and you will see what has happened). I must admit I found the way the sort to be curious - although I would tend to ignore it in this case unless it was causing any particular problems....
  7. IIRC you can use the "DOMAIN\User" style of login - if on win2k domain then you might be able to use your UPN.
  8. If you try changing from a specified collation to binary it will probably work correctly - however it will also treat upper and lower case characters as being different i.e. things begining with a - z would come after A - Z, probably not what is desired. It looks as though the ordering is being affected by the characters that come after the - or . Not too sure what the exact deal is with the collation orders but there does appear to be a certain logic to it.
  9. Do you happen to know what collation order the SQL server is configured to use? Not all languages sort based on the raw ascii values - often different collation orders will have differerent ordering for punctuation / extended characters. In SQL 2000 if you go to the table designer you can configure the collation on a column by column basis if required - it may be worth seeing if changing the collation affects the results.
  10. If you declare the variables as static then you can access them using the classname.variablename syntax rather than creating an instance of the class. However global variables can lead to hard to maintain code - they can be changed from anywhere, you may want to look at organising your code differently to reduce the need for globals.
  11. try Dim x as New localhost.classification
  12. Is the error being raised by the client or the server? If possible could you post the code from the client and maybe the server methods that are failing - or do all the server methods fail?
  13. Current versions of VS do not have a replacement for the axwebbrowser component, future versions however will ship with a manageed version of the web browser control.
  14. What is the value of docID when you are getting this error?
  15. Active EXEs don't have any direct .Net equivalent, probably the best thing to do is move the reusable code into a classlibrary and have the .EXE application call into this classlibrary. If you require multiple simultaneous calls to this classlibrary then you may want to investigate threading rather than spawning multiple processes.
  16. Not got SQL handy to test but it may be failing on the field Date (it's a keyword) - try using [Date] instead.
  17. You could always use Visual Source Safe (not my personal choice) or some other form of Source Code Control. Up till recently my favorite has always been CVS (you can get the server part for free from (https://www.cvshome.org and an NT version from http://www.cvsnt.org with a good client from http://www.tortoisecvs.org/download.shtml) Recently though I've made the move to subversion (server from http://subversion.tigris.org/ with a good client available at http://tortoisesvn.tigris.org/)
  18. Debug builds generally run slower as they are designed for debugging and relate to the source code and the .pdb files very closely. In a release build all code that references the System.Diagnostics.Debug class are effectively removed and have no run time overheads. The compiler (and the JIT compiler) also may re-write parts of your code to a more optimal form (search google for specifics but they include standard compiler features like inlining, invariant hosting, moving constants out of loops etc). For a finished project that is to be released to the public then use a release build - as Denaes said though debugging support is eriously hampered in a release build.
  19. The wizard is useless at best and a downright menace at worst - when it works it doesn't take advantage of the .Net framework and merely ports the VB6 code (hacks, API calls etc) as is. Often it wraps simple .Net functionality with an extra layer (Microsoft.VisualBasic.Compatibility.dll). It doesn't even manage to port the common dialog / common control functionality despite the fact there are .Net equivalents - it still wraps the ActiveX components. In nearly all cases if your app is simple enough for the wizard to migrate without errors then you could have probably easily re-written it - anything more complicated and it will fail in many interesting, but not recoverable, ways. To really take benefit of the move it's often worth considering a redesign of your app to take advantage of the newer features (better interface support, inheritance, delegates, newer controls, the class library, exception handling etc....)
  20. Still worth considering SQL as with SQL 2005 (formally Yukon) you can have the Express version, which can be used without the need to install a server as such, but still uses the same core engine as the full SQL product (stored procs, views, functions, security etc) and is 100% compatible with the full server product (usual disclaimers about beta software apply ;))
  21. In your code the original allocation of memory for l2 is never actually used - although allocated it is no longer required after the line l2=l1. Could you not write a method that accepts a label as a parameter and have that method do all the property setup rather than trying to copy the properties from another instance? Would probably be easier in the long run. Failing that you may want to investigate reflection - although this will do what you want there could well be an associated performance hit if you are doing this with many controls / properties.
  22. The second link in my post gives a possible solution - haven't tried it myself though and I doubt it will work on all OSs either.
  23. may not be the answer you were after but this link on msdn gives the answer of 'you don't'. however this one gives you a way of doing it (also a MSDN link ;)) Not sure if there is a 100% guarenteed way of doing it across all OSs though... Just as an aside I personally have a low opinion of software that either disables alt+tab - it's my PC and if I want to alt+tab I probably have a good reason, who are you to tell me otherwise, or fails to handle it correctly. If you are doing and DirectX / Direct3D stuff then you should really have some resource management routines within your app - all you would need to do is handle the loss of focus, unload the resources and pause the app state. On regaining focus simply reload the resources and un-pause the state.
  24. l2's text property will equal that of l1 - check in the debugger, however what you are really doing is setting l2 to reference l1 (both variables point to the same area of memory). This means they will also ocupy the same location on the form - it will only ever appear to be a single control (because it is a single control with 2 variables that point to it). you could just assign the test property (also remember to position them differently as well) Dim l1 As New Label Dim l2 As New Label l1.Text = "Test1" l2.Text = l1.Text l1.Location = New Point(100, 100) l2.Location = New Point(150, 150) Me.Controls.Add(l1) Me.Controls.Add(l2)
  25. Not got VS on this machine but I'm fairly sure you can mark the constructor private rather than protected and if the then also mark the class as sealed it should cover both eventualities. public sealed class Test { public static int SomeValue; private Test() { } }
×
×
  • Create New...