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
D

dbetting

@dbetting
About
Posts
66
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DataGridViewCheckBoxColumn on-click Event
    D dbetting

    I have a DataGridView with an unbound DataGridViewCheckBoxColumn in it. I'm able to manipulate everything as planned with one exception. I cannot seem to detect the appropriate value change when the user clicks the check box. The only event that comes close is CellEndEdit but the problem with it is that it only fires upon exit of the row...but it is the right value! My test is:   if (e.ColumnIndex == 0)   {     MessageBox(grdVwReadyOrders[0, e.RowIndex].FormattedValue.ToString()     + " " + e.RowIndex.ToString() + " " +     grdVwReadyOrders["OrderId", e.RowIndex].FormattedValue.ToString());   } I know I'm on the right row because I get the correct OrderId but regardless of which event I try, either 1) it doesn't fire upon checking or 2) it seems to only detect the value as it was when the user selected the row. What I need to do is detect, at the time the user checks the box, the value after it is checked. If it is checked, I need to do processing on other rows in the view. Doing it only as they leave the row is not user friendly. Thanks.

    C# help

  • Turning off the insertion point.
    D dbetting

    I understand you would like to have TextBox.Enabled=true but if you are trying to control the user's actions, you need to make it very clear to them what is expected. Upon loading or clearing the form, set the data entry controls read-only. Then upon clicking the [Add], [Edit] or whatever the button is called, the first thing you do is enable your text boxes, radiobuttons and any other controls the user is to access for data entry. If you just hide the cursor, the user clicks on the TextBox and says "What's wrong? The cursor disappeared!" If it is disabled, it is pretty clear the only option they have is to tell the program what they want to do such as [Add], [Edit], etc. I usually have two core methods in most of my forms: Clear() and SetReadOnly(bool value). Upon loading the form or saving a record Clear() is called which sets all the default values for the fields. One of the last lines in Clear() is the call SetReadOnly(true); to disable all the controls. The only option the user has at this point is to click [New] or [Cancel]. If they click [New], I call SetReadOnly(false); and set the focus on the first field I want them to fill in (i.e. TextBox.SetFocus();). Just a suggestion.

    C# question csharp help

  • urgent
    D dbetting

    Turn the slashes the right way. System.IO.DirectoryInfo dI= new DirectoryInfo(@"c:\mydir\mysubdir");

    C# question

  • Passing in an array
    D dbetting

    The easiest way to do it is to create a new collections class. The collection class can be of whatever you need. Now your parameter is the class object. You populate it with what you need in the parent method, pass in the populated class to the called method.

    C# csharp visual-studio mcp data-structures

  • Assembly Versioning
    D dbetting

    I have a project that started out in VS2003. The last build in 2003 was 2.0.20727.42. I had the AssemblyVersion value in AssemblyInfo.cs set to 2.0.*.*. Things worked as I expected. Now in 2005 I identified the new AssemblyVersion to 3.0.*.*. If I use Environment.Version, I keep getting the version from 2003 (2.0.20727.42) and it is never changing. If I set AssemblyFile, then I can see that value in Application.ProductVersion but a) This is a string I'd have to break down to get the versionning if I was to use it. b) It doesn't auto-increment. When I did the upgrade from 2003, I created a new project in 2005 and then I used "Add Existing..." to add the forms and User Controls. Did something else get sucked in that is not allowing me to get the correct Environment.Version?

    C# winforms question announcement workspace

  • VS 2005 Slow
    D dbetting

    Yes. Apparently C# IDE specifically has some issues and unfortunately, that's what I program in. I have turned off automatic backups, I've turned off the navigation bar and I've turned off the intellisense they want off. These have helped and I am now at annoyingly slow rather than cripped, as I was. There was one hotfix that Microsoft grudgingly gave me (kbid=841978). I have an OEM installed O/S, heavens forbid, so they were instisting I was suppose to go through the OEM to get my fix! It is installed but I have seen no improvement with that. It did fix the issue outlined in the KBID so at least other things sped up significantly. Thanks.

    Visual Studio csharp visual-studio design question

  • VS 2005 Slow
    D dbetting

    I installed VS 2005 a couple weeks ago. I took our main project which is in C# along with its associated dll's and recreated it from VS 2003. Because I was told the in-place conversion is a bad idea, I created new projects and added the appropriate forms as was recommended to me. I've now spent the last 2 days trying to use this....program. To say it is slow would be an extreme understatement. I am running a HP Xeon 2Ghz processor with 1GB RAM. Before starting VS 2005, I have 400MB in use, after starting I have 830MB in use. I have about 30GB of disk space free and all my updates are current. When I switch design forms, I will wait about 20 seconds for the page to redraw. The current page I'm working on has 35 field on it plus labels. I drop an item on the form (takes about 15 seconds) and then change the name. I then get a refactoring message for 25 to 50 seconds. If I want to move something, I click on it and half to wait for about 10 seconds otherwise I end up moving something else on the form instead of the object I clicked. I had a Dell laptop that I loaded VS 2005 on before. I figured it just wasn't big enough so I bought a new one. I can't do much better than this one! As long as VS 2005 is not minimized, devenv.exe is running at least 45% of my CPU. Minimize it and I'm fine. Any suggestions? Can I somehow replace .Net 1.1 with .Net 2.0 in VS 2003. I'm willing to just stay with that rather than fight with this junk until Microsoft fixes it (but I need 2.0). I can only see that it is them, not anything I have on my machine because this machine is still pretty clean! I've search Code Project for "2005 slow" and "visual studio slow" and didn't get any hits.

    Visual Studio csharp visual-studio design question

  • ListView Color
    D dbetting

    That was the key. Thank you very much! :-D

    C# visual-studio graphics question

  • ListView Color
    D dbetting

    Playing with the ListView to try to get colored backgrounds.

    ListViewItem lviGrossMargin = new ListViewItem(strListViewItem);
    lvOptions.Items.Add(lviGrossMargin);
    lviGrossMargin.SubItems[0].BackColor = System.Drawing.Color.Wheat;
    lviGrossMargin.SubItems[1].BackColor = System.Drawing.Color.SpringGreen;
    lviGrossMargin.SubItems[2].BackColor = System.Drawing.Color.YellowGreen;
    

    If I set lvOptions.Background, I color the entire background the identified color. But coding as above, I get the same result. Setting SubItems[0] to Wheat sets all SubItems. Setting SubItems[1] or [2] does nothing. Playing with the SubItems[n].Text does apply the expected text in each column. If I play with ForeColor, same as BackColor occurs. [0] is recognized and applies it to all SubItems. It is only the colors that don't seem to work. Is there a step I skipped that has to be done before manipulating colors or is it a feature that doesn't work correctly in VS Studio 2003?

    C# visual-studio graphics question

  • simple user control / panel question
    D dbetting

    I do this frequently.

    UcInfo = new ucInfo(this); // Instantiate the UC
    UcInfo.Parent = pnl01; // Assign the panel as the UC parent
    UcInfo.ShowLookup = false; // I have preprossing in the UC that I want executed
    pnl01.Height = UcInfo.Height + 8; // In this case, I'm adjusting the size of the parent panel to the hieght of the UC
    UcInfo.Dock = DockStyle.Fill; // Now dock the UC into the panel
    pnl01.Dock = DockStyle.Top; // Position the panel on the form
    ... // There can be other preprocessing you might need done on the UC.
    pnl01.Visible = true; // Now show the panel

    C# question tutorial

  • Crystal Reports with Multiple Values
    D dbetting

    I've been trying to find a solution to this problem. Searching here, Business Objects and several other sites, I'm finding many requests outlining the same problem but in none have I found an answer to it. Given the programatic declaration of a Crystal Report as defined below, it works great in all reports except when I need to use a variable that has to accept multiple values such as prmStatusCodes. With this parameter, the user identifies with check boxes the status' of orders they wish to view. rptCustomerSummary newRpt = new rptCustomerSummary();
    CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    rptDocument.Load(ReportsPath+"rptCustomerSummary.rpt");
    crViewer.ShowGotoPageButton = true;
    crViewer.ShowPageNavigateButtons = true;

    CrystalDecisions.Shared.TableLogOnInfo rptLogin = new CrystalDecisions.Shared.TableLogOnInfo();
    foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in newRpt.Database.Tables)
    {
    rptLogin = tbl.LogOnInfo;
    rptLogin.ConnectionInfo.ServerName = dbServer;
    rptLogin.ConnectionInfo.UserID = dbReportLoginName;
    rptLogin.ConnectionInfo.Password = dbReportLoginPwd;
    tbl.ApplyLogOnInfo(rptLogin);
    }

    /* Customer Id Parameter */
    currParamValue = new ParameterValues();
    paramValue = new ParameterDiscreteValue();
    paramValue.Value = CompanyId.ToString();
    currParamValue.Add(paramValue);
    paramFieldDefs = newRpt.DataDefinition.ParameterFields;
    paramFieldDef = paramFieldDefs["prmCustomerId"];
    paramFieldDef.ApplyCurrentValues(currParamValue);

    /* Selected Status Options */
    currParamValue = new ParameterValues();
    paramValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
    foreach (int i in ReportOptionIntAry)
    {
    paramValue.Value = ReportOptionIntAry[i].ToString();
    currParamValue.Add(paramValue);
    }
    paramFieldDefs = newRpt.DataDefinition.ParameterFields;
    paramFieldDef = paramFieldDefs["prmStatusCodes"];
    paramFieldDef.ApplyCurrentValues(currParamValue);

    crViewer.ReportSource = newRpt;In Crystal Reports, I've defined the parameter prmStatusCodes as a Discrete of type Number and Allow Multiple Values. In the report Select Expert I have

    RPT_CUSTOMER_SUMMARY_V.CUSTOMER_ID} = {?prmCustomerId} and
    {RPT_CUSTOMER_SUMMARY_V.STATUS_ID} in {?prmStatusCodes}

    In the report, if I change {?prmStatusCodes} to [5, 7

    C# database algorithms business sales help

  • Releasing Memory
    D dbetting

    Setting didn't seem to be worth anything to me but one of my contractors insisted it was necessary. Every time he does an object.Dispose(), the next line is object = null. The allocation of data is pulling information from the database and displaying it on screen. The screen does allow maintenance so there are several drop-down boxes on the form as well as the order data itself. I've never understood the 3MB from the beginning since it only seems like a few K of data. To my knowledge, the only way to use unmanaged memory/code is to explicitly code it and block it into an unmanaged code block. I don't do that anywhere. If there is a way to use unmanaged memory inadvertantly, let me know what the key words are that I need to be looking for and I can focus on those. I've downloaded CLR Profiler to see what is going on. The reason I use the Task Manager is because the boxes I'm using the application on are Citrix boxes with 4GB of memory. I have about 35 users on the system and at 9:00 I'll be sitting with about 1.5GB in use and the box is happy. As it gets to 4GB and 5GB (in the task manager), that's when things start getting flakey. So I was using that as my guide as to how the box is performing. I can look at the individual processes and those people that are 150MB to 300MB, I have them log out and log back in, memory drops back down to 2-3GB and everyone is happy again for a while. I do thank you very much for your time.

    C# question csharp docker performance announcement

  • Releasing Memory
    D dbetting

    Based on these conversations, I've tried a few other things. Inside FrmMasterParts, I've stepped through the creation of it and each UserControl I create inside of it. Each item I've created, I ensure there is a Dispose() or a null set to it in the Dispose() method (The enums and such didn't like that so I took them back out!). Literally, if it wasn't a form component, I added it to the Dispose(). I did this for the form and each UC. When executing the program, upon the second and successive instantiation of FrmMasterParts, it's entire content (with the exception of the components) has everything set to undefined (as expected). This would validate that a clean copy of the form is being created with the using(). Upon display of the form, the additional memory is added. Upon the last brace of the using(), FrmMasterParts is no longer accessible but the memory has not been release. Execute GC.Collect(). Still no luck. The last time I used a memory tool was the early '90's. Do you know of one that I can try to look at the physical memory to get an idea of what is being left out there? An interesting note: When I minimize my 100MB program, task manager drops by about 99MB. Maximize again. I can do all kinds of stuff and memory stays small. Click the button to open this form, almost all 99MB comes back. Evaluate the content of FrmMasterParts in Autos, and it is empty as discussed above. This is going on on my Dell laptop, a Compaq laptop as well as the development workstation and production servers so it isn't hardware related. Thanks for your time.

    C# question csharp docker performance announcement

  • A Console window for Trace.WriteLine
    D dbetting

    Sound like you might be doing what I was doing. I kept writing Console harness apps to get the output to track what's going on while developing until I found out about System.Diagnostics.Debug.WriteLine(). If you're using .Net Studio, it will display the information in the Output window. I use it in both windows forms or special classes that have no GUI interface. Sure beat the heck out of the test harnesses.

    C# tutorial debugging question

  • Releasing Memory
    D dbetting

    My understanding of using using() was that you don't have to worry about the dispose. That's why it was one of the first things I did when the leak showed was made evident. I replace all declarations with the using() structure. But, to make sure, I added the line. Didn't cause a problem but didn't fix it either. The line after the braces I had a break point. Nowhere in this. (using the Autos tab) is there any reference to FrmMasterParts. But, when the program started, I had 35MB memory in use. 15 executions of showing this form put the memory at 100MB. I just added System.GC.Collect() after the brace. Still the same result.

    C# question csharp docker performance announcement

  • Crystal reports
    D dbetting

    You need to use parameters. There are good examples at Business Objects. The have a .Net starters guide at http://www.businessobjects.com/jump/xi/default.asp[^] that was very helpful. If you also reference their knowledge base, they have many examples of how to set up running a report from within you app as you seem to be attempting.

    C# csharp database security sales

  • Releasing Memory
    D dbetting

    This particular form is opened from several places within the program. It is used to review information about existing orders in the system. Every time it opens, the executable grows by about 3MB. After a couple of hours, the user session is at hundreds of MB. Guffa wrote: If the components reference is null, there are no components needing disposal. If there are components that needs disposal, they are added to the components collection in the generated code. This is what has me confused. No place in the form code is components referenced. Stepping through Dispose() of the form, when on the last brace, all the objects I have created are now showing undefined (I did have two that did not dispose properly). The only thing left at that point are the various components as defined objects. components evaluates as null and therefore the line components.Dispose(); is never reached.

    using (frmContainer FrmMasterParts = new frmContainer())
    {
    FrmMasterParts.SetSalesOrderInfo(SelectedOrderNumber, SelectedReferenceNumber);
    FrmMasterParts.ShowInTaskbar = false;
    FrmMasterParts.StartPosition = FormStartPosition.CenterParent;
    FrmMasterParts.ShowDialog();
    }

    Instantiating and calling the form is as straight forward as can be (above code). The dispose of FrmMasterParts does execute and that is what I was stepping through (shown in original message). Guffa wrote: You can't set the form to null. You can set a reference to the form to null, but that doesn't affect the form. Just to see what would happen, I attempted to set FrmMasterParts to null. Unless I'm mistaken, if that did work, that would've made the memory block unreachable and it would never be released. At least that was the case in Delphi. I was just curious and surprised by the result. FrmMasterParts remained defined and unchanged.

    C# question csharp docker performance announcement

  • Releasing Memory
    D dbetting

    I have been trying to figure out a memory leak for quite some time. I've ignored what C# is supposedly taking care of but now that is the only thing I have left. And...I discovered something I'm confused about. Add a new form to a project and drop some components on it. You will find private System.ComponentModel.Container components = null; and protected override void Dispose( bool disposing ) {   if( disposing )   {     if(components != null)     {       components.Dispose();     }   }   base.Dispose( disposing ); } But there will be no further reference to the use of components. Therefore, when I dynamically create a form frmDialog(), do what I have to do, then Dispose() of the form, it fails the if(components != null) check and the components are never released. I even set the form to null (which I know I shouldn't do) but that still left the form defined. In the main form, frmDialog still exists as a defined object. In frmDialog() I add my own Dispose() calls for my classes and they show as undefined but every component of the form is still defined. I suspect that is why my memory is never released; because the form components haven't been released (showing <>) the form can't release. 1) My understanding is "Don't do any maintenance within the #region Windows Form Designer generated code section so how do I get the components of the form into the variable components so they can be destroyed? or 2) Is there a routine I can add to the Dispose() method to dispose of all the components by hand? Why would I have to do this? Thanks.

    C# question csharp docker performance announcement

  • Memory Leak
    D dbetting

    Can someone give me a suggestion? I've tried several different methods of creating this form and destroying it when I am done, all with the same results. This seems to be the cleanest and easiest method to use but it still does not give a good result. using (frmContainer FrmMP = new frmContainer(null, TFormList.MasterParts, -1)) {   FrmMP.SetSalesOrderInfo(SelectedOrderNumber, SelectedReferenceNumber);   FrmMP.ShowInTaskbar = false;   FrmMP.StartPosition = FormStartPosition.CenterParent;   FrmMP.ShowDialog(); } Upon opening this window, I've added 3K to my memory. Wouldn't be a problem except it gets called several times per hour. For some people this is 100K per hour. The only way I've been able to actually get the memory collected is by minimizing and then resuming the program. Not very convenient for the user and they don't know when they need to go through that ritual (nor should they). I've tried several different calls to do garbage collection (even though it is not recommended) but these didn't work either. A session will usually start at about 10K. When it hits a couple hundred K, I can minimize and restore the pgm and it is usually back down to 15-20K. If I do not minimize, it just continues to grow. Any suggestions?

    C# performance help question

  • Custom Component Issue
    D dbetting

    I'm not sure why this question bothered someone to where they jest with their own version of it. I guess the bottom line is that my understanding of the properties is that they are stored in the Component Designer section of the code. If I open the window again to maintain it, the Component Designer code should've repopulated the property editor...but it doesn't. Whether it is my component or not, I wouldn't think it would matter. I don't believe my question is that far out of line.

    C# delphi graphics 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