Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

LongRange Shooter

@LongRange Shooter
About
Posts
844
Topics
135
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Convert Inner Join to LInq???
    L LongRange Shooter

    excuse my typing...my puppy is asleep in my one hand. breaking down the linq:

    from t1 in context.Table1

    t1 is an arbitrary variable name that linq binds to Table1. now when you use the variable you get intellisense on all fields in the table.

    select new { t1.field2, t2.field3}

    The select new is creating a new object that is a blend of fields from the two tables. You may want to see if there is a name parameter since you need that type name for enumeration. Now if you used a key in table 1 to get everything out of it's child table 2, then you could do this:

    select t2;

    The reason you don't need the new keyword is because t2 is a predefined variable.

    modified on Thursday, February 19, 2009 4:20 PM

    LINQ question database csharp linq help

  • How do I identify that a record is a result or a Default?
    L LongRange Shooter

    when executing the following code:

    SomeObject myObject = context.Table.SelectSingleOrDefault();

    How can I easily determin that the value of myObject has been set to default instead of a value? Thanks

    LINQ question

  • Status Strip Progress bar graphics not accurate???!!!
    L LongRange Shooter

    Okay...cut short my entire process. Here it is:

    	private void SetProgress( int progressValue, string message )
    	{
    		this.loadProgress.Step = progressValue;
    		this.loadProgress.PerformStep( );
    		this.loadStatus.Text = message;
    		this.Refresh( );
    		Application.DoEvents( );
    		Thread.Sleep( 1000 );
    	}
    
    C# tutorial graphics help question

  • How come this If sentence doesnt work?
    L LongRange Shooter

    Your problem displays the most common failure of beginning programmers -- mixing their 'AND' and their 'OR' logic. You also need to think of how to address your other requirement that the text begin with 2,3,4, or 5. A possible solution is first to write what you want out in text if b starts with a valid number and textbox contains valid numbers then it's ok. That leads to code such as this:

    string b = "3.12321212";

    List<char> validValues = new List<char> { '2', '3', '4', '5' };
    List<string> validInput = new List<string> { "703", "733" };

    textbox1.Text = "Not OK";

    if ( validValues.Contains( b[0] ) && validInput.Contains( texbox.Text ) )
    {
    textbox1.Text = "OK";
    }

    Another way you can also address this problem is with RegEx but I don't have the time to figure out the pattern.

    C# question

  • Status Strip Progress bar graphics not accurate???!!!
    L LongRange Shooter

    I have a status strip which displays a progress bar during initialization and execution phases of my application. In the designer I set Max=100 Min=0 Step=10 The bar progresses as expected, but when I reach completion I set the bar value to 100, put out my complete message, and sleep the thread for 1 second. The Progress bar is always showing only about 80% of the progress bar painted. I've experimented by taking the value to 101 (for example) and it doesn't like that. I've also paused the code and validated that the value is indeed set to 100. Has anyone experienced this or (better yet) figured out how to fix this? Thanks in advance.

    C# tutorial graphics help question

  • Where is the Exceptions window
    L LongRange Shooter

    I have a web project that began rejecting my connection when doing an HTTP get. The implication is that my HTTP handler is bombing out and isn't there to handle my request. In earlier versions of VS the debug screen had the Exceptions screen that let me stop my code the moment an exception occured. In VS2008 it is not there. So how do I do this now?????

    Visual Studio question visual-studio debugging

  • web service error
    L LongRange Shooter

    If you are able to debug to the point of seeing the exception you will see that the inner exception reads something like The server has actively rejected your connection. In the case of the web service it is an indication that the service is not started. If you server and client are in the same solution, try going into the Solution and marking the project as having two startup projects: your client project AND your webservice project

    ASP.NET csharp help question

  • VS2008 test web reports I'm Unathorized and is stopping me from critical testing!!! HELP!
    L LongRange Shooter

    I have a web project that is only doing put and get over HTTP. The website consists of only HTTP handlers. When I changed one of my web.config to point at a temporary database, I began getting the Unauthorized exception, with an internal exception that says the server actively rejected my connection. I'm running VS2008 under Vista SP1. There is no Temp ASP.NET Files folder to delete which others have said is a solution to the problem. Any suggestions on getting past this??? I've put it back to my current database but I'm still failing. I also compared web.config files with my co-developer and they are identical. I really need help on this one! Thanks, Michael

    ASP.NET help csharp asp-net database sysadmin

  • Getting the value of a primary key that is an Identity field
    L LongRange Shooter

    I am creating a new record in the database. The key is an identity field and the database is set to not allow inserts of assigned values. I need to return the results of the INSERT to the user. Is there anything I can do in my SQL that will let me return that key value? Is there something like a @PrimaryKey? Thanks

    Database database question

  • A question regarding the Debug...Exceptions dialog
    L LongRange Shooter

    So here is actually a Visual Studio question in the Visual Studio forum! In all prior versions of VS, you were able to bring up the Exceptions dialog to have all exceptions raised to the debugger at the time of occurance. Important when the catch is occuring 3 class away from the actual blowup. In Visual Studio 2008, however, that option is missing. Yet the online help constantly talks about the Exceptions Dialog!!! So how the heck to I open it up now? I hate it when Microsoft changes the location of something that has been there for the past 5 years!

    Visual Studio visual-studio debugging question csharp help

  • Dynamically selecting a form [modified]
    L LongRange Shooter

    I've frequently written code where an action relates to a class to be executed. Your process is similar. So let's assume that all of your forms are compiled into a separate assembly: Mycompany.Myapplication.DynamicFormsAssembly.dll and the dll name matches the assembly name.

            void ShowDynamicForm( System.Windows.Forms.Label sender )
            {
                Assembly assembly = Assembly.GetAssembly( typeof( Mycompany.Myapplication.DynamicFormsAssembly ) );
                Form dynamicForm = ( Form )assembly.CreateInstance( sender.TextProperty );
                dynamicForm.Parent = this;
                dynamicForm.Show();
            }
    

    Good luck doing this in VB.

    Visual Studio csharp database tutorial question

  • Which language should I start with?????
    L LongRange Shooter

    Before you begin to write programs, the first thing you should do is make a design of something you want to write. (but make it simple....don't expect to be doing 3D animation your first time out) Now that you have your design, develop what the user interface should look like. (all the screens, the flow through the application, etc) Now start a C# project. VB.Net is not as big in the industry as C# and in complex programs it is not the same as C#. C++ is way too deep of a language for a self-starter. Look through here at some of the C# projects that are highly rated. This gives you a good way of learning good development skills. Create a form and create the first screen from your screen designs and then put code behind it. Do this for every screen you designed until it is done. Then enjoy the "pleasures" of debugging. A general rule of thumb : while coding you will probably lean toward monolithic development. (all your code inline when and where you need it) Later you will begin to see you are writing some pieces of code several times. The rule of thumb is when you do it a third time, it's time to make that a new method. In C# you just select to code, select the Refactor...Extract Method and Visual Studio does the rest for you. (this doesn't exist in VB.NET) As a result you will begin to develop some basic object oriented development skills this way.

    Visual Studio csharp c++ visual-studio question

  • how do i make a face talking by using c#
    L LongRange Shooter
    Hand myHand = new Hand(typeof(Animated));
    Hand otherHand = new Hand(typeof(Drawing));
    myHand.MakeAFist();
    otherHand.DrawFaceOn( myHand );
    myHand.HoldSideWays();
    myHand.Talk();
    
    Visual Studio csharp question

  • Update Resource(.resx) file
    L LongRange Shooter

    Doing a little googling I find that you have done two things wrong. First you defined your FileStream wrong. You have it set of Create or Open and do not have it set for ReadWrite Next you are only using AddResource for everything. Look at AddResourceData. If none of those help then you are SOL. And while you may not like what I say, I do not like jobs stolen by cheap Indian labor and then having the same job theives coming here begging us to write their code for them or help them become programmers.

    C# question announcement learning

  • Update Resource(.resx) file
    L LongRange Shooter

    The very, very basic process of changing an element in an array: resource["text"] = "test 123";

    C# question announcement learning

  • A question on having multiple source log to an eventlog
    L LongRange Shooter

    Hi Dave. I'm not getting any exceptions during the process execution. But I am running under LocalSystem. I have security set to LinkDemand inheriting the rights from the service, and the service (for now) Asserts SecurityPermission. We are still in development and (as pointed out) we have a constantly changing environment at the moment. In fact we may be looking at yet another log file change in a few months just because the owning company is going to change the company name and they don't want a log file with the old name. Thanks.

    C# question

  • Using "using"
    L LongRange Shooter

    >>Eventually the garbage collector will collect the object; however, that doesn't necessarily free resources. The finalizer will be called unless suppressed, but that will only call Dispose if you specifically do so in your finalizer code.<< The using command, especially when applied to IO resources, is more complex than just calling Dispose. For example take this segment of code:

     using ( FileStream list = Text.OpenWrite( path ) )
     {
              foreach ( UniqueObject item in myArrayOfObject )
              {
                   list.Write( UniqueObject.Message, UniqueObject.GetAverage() );
              }
     }
    

    When you exit the using block, three things will happen. The buffer will be flushed, the file will be closed, and the object will be disposed of. Likewise (and more importantly) if UniqueObject.GetAverage() blew a divide by zero exception your code would leave this execution block. When that happens....using will flush the buffer, close the file, dispose of the object. This process first and formost protects long-running application from creating memory leaks leaving these streams and rare resources around. Secondly it ensures that any unmanaged resources (like file handles) are released. Finally it ensures that even an exception will not cause your file to get corrupted by early interuptus.

    C# question

  • How can i remain focus on the listview [modified]
    L LongRange Shooter

    It has been awhile since I coded any drag-and-drop events but there are things you must do to have it happen correctly. I believe the issue goes beyond getting focus for your listview. Panel1 I believe must be set to that you catch the beginning of the drag event. From the event you can review what object is being chosen and approve or deny it. If approved you must then put that object (or representative of it) in the clipboard. Now in Panel2 -or- in your ListView you need to capture the dragover(?) or dragenter(?) event. Basically it is raised any time an item is dragged over it. If you do not catch this event then you will never be allowed to drop anything. In the event handler you would then interrogate the clipboard to determine if the object type is what you would allow..and if so return the indicator in the event args that you will accept the object. Finally your drop event either in Panel2 or your ListView (your broken english was readable but not clear as to whether you are dropping in the second panel or your listview). When you get the event, you can then 1) pull the object from the clipboard 2) get out of it the items/files/work you need to get out of it 3) do your population Hope this helps. I'd suggest you google Coding Drag And Drop to see if you can find more details that can help you solve your problem. You will especially need it when adding the object to the clipboard. I remember havin one object that I could not add and don't remember the attributes that had to be added to make it addable.

    C# help question

  • A question on having multiple source log to an eventlog
    L LongRange Shooter

    Well, first of all I don't care who or what he is. He could answer the question or shut up. He did not answer the question nor did he behave in a fashion I'd expect of a site MVP. Secondly, his comment was one of a smartass not someone being helpful. Finally, my claim can be backed up by anyone that has access to the Robert Half testing scores...the results showed that locally here the average score was 72 and internationally it was 79 while I score 93. As to more experience....I've not seen anything that indicates he has more experience than me, especially since I've been writing code for 30 years and he's only been at it 15 years. I was also in a group that was part of the C# early adapters program and was working with Microsoft in finalizing the language within Visual Studio. Being a site MVP just means he either has no job or no life so he can jump in and answer a ton of questions before anyone else. I've been on this site for many years, been help to many people and I always try to provide help and not criticism, except where some constructive criticism can be of help. Finally with the exception of the use of the various literals in beta code, there is nothing wrong with my code that I can see. And if there was indeed a major issue with how I wrote the code I'd love to have some one point out what it is.

    C# question

  • Looking for HELPFUL information on my event log issues
    L LongRange Shooter

    I have three threads that are trying to write events to a single event log -- with each thread being a separate source. Each thread creates an instance of the EventLog and uses eventLog.WriteLine() to post the event. In initialization each thread checks to see if its' source name is registered to the log. If it not, it registers itself. Then each thread creates an instance of the eventlog passing the logname and source name, after which a success message is posted to the EventLog. The first thread establishes itself and its' events are getting logged without problems, but the other two threads are not getting their events written. Any help would be appreciated.

    C# help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups