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
T

turbochimp

@turbochimp
About
Posts
223
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Clarification On Static Member [modified]
    T turbochimp

    First off, this is an ASP.Net question, not one specific to C#. You should post it to the ASP.Net forum for more timely response. Now, unless you personally make some attempt to persist your data source (or reconnect and query it each time) across page turns, it will not persist itself. At the very least, you need to bind your data source to its control after each page turn (Postback or not), and at most - meaning if you don't want to reload your data after each page turn - you need to persist it statefully. The static variable is a bit much for this application, but it proves the point. Is ViewState enabled for your dropdownlist? If you're doing filtering after your initial binding it won't really matter since you'll need access to your datasource, not the expression of the data in the control, but it's something to check. Other ways to do the same thing would be to push the data source to ViewState manually, or use the Session or Application objects - it all depends upon your needs. I would recommend looking up the ASP.Net page life cycle to better understand what happens each time a page is turned (whether it's a new HTTP Request or a Postback). Good luck

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# database sysadmin help question

  • exception error caused by reading text file
    T turbochimp

    Posting the exception you're receiving would be very helpful, but it looks like you're calling ReadLine twice without any assurance that you have two (or a multiple of two) lines to read. Readline is going to advance the cursor each time it's called. Additionally, if the code above is inside an error handler, I would point out that it might not be the best choice to open and parse a text file every time a key is pressed. Finally, a TextReader is a disposable type, so I would recommend either inserting a Try...Finally block or, better, a using (TextReader syntax_blue = ...) block instead.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# help

  • printing html file without printdialog show up
    T turbochimp

    Have you looked at PrintDocument? ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref8/html/T_System_Drawing_Printing_PrintDocument.htm Example:
    class Program { static Font printFont = new Font("Arial", 10); static void Main(string[] args) { PrintDocument doc = new PrintDocument(); doc.PrintPage += new PrintPageEventHandler(doc_PrintPage); doc.Print(); } static void doc_PrintPage(object sender, PrintPageEventArgs e) { float leftMargin = e.MarginBounds.Left; float topMargin = e.MarginBounds.Top; float yPos = topMargin + (printFont.GetHeight(e.Graphics)); // In the line below, 'Hello' would be replaced with the next line from // whatever you were trying to print. // It's actually a little more involved, but not terrible. e.Graphics.DrawString("Hello", printFont, Brushes.Black, leftMargin, yPos, new StringFormat()); e.HasMorePages = false; } }

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# html question

  • Constructor
    T turbochimp

    Basically, constructors are special methods that are called when an instance of a class is created. Unless the class is marked 'static', a public default (parameterless) constructor is created for it by the compiler. Here is an article that has examples.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# tutorial help question

  • Reasonably priced WinForms text editor control...suggestions?
    T turbochimp

    Hi, I would have thought finding a decent WinForms text editor control was a no-brainer when I started my most recent project, but there seem to be no mid-range text editors (RTF or otherwise) on the market at prices I can afford or feel good about paying. Perhaps my needs just fall into a gray zone in the market, but here's what I'd like to get without spending $600 or more: 1. Should support bullets and numbering (multi-indent) 2. Should support standard formatting (right/left/center justify; indent, outdent etc.) 3. Should support drag and drop 4. Should support standard text decoration (font, bold, italic, fore-color, back-color) I've gone a fair way to just building one myself, but the subtleties of RTF are a constant drain on my time - particularly things like numbered bullets and multi-level (indented) bullets; I'd really rather just buy something and get on with it since the text editor is a small part of the overall project. It doesn't make sense to take on the responsibility of authoring and fully testing a component like this when it really only makes up a small percentage of my application's features. Any helpful suggestions are welcome and appreciated. Thanks for your help. P.S. Yes, I've looked at TX Edit, PinEdit WP and their contemporaries. They're really nice products, but pretty expensive and they tend to be a little too feature-rich for my needs. What I would really like would be something along the lines of FreeTextBox for WinForms.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    .NET (Core and Framework) csharp winforms testing beta-testing help

  • what is wrong in this code
    T turbochimp

    Really not enough to go on in your post, but here's one idea for a debugging route: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=347286&SiteID=1[^] Good luck.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# csharp help question

  • textbox-table
    T turbochimp

    (1) Are you referring to WinForm or WebForm applications for item 1? If you're using WinForms, then you should be able to do something like the following in the form's codebehind: public AddTextBox(string id) { TextBox box = new TextBox(); box.ID = id; box.Top = 150; box.Left = 20; this.Controls.Add(box); } You can do something very similar to the above WinForm example with WebForms, but positioning will take slightly more attention, as will the timing of your control's addition to the form's control hierarchy. (2) Are you referring to a DataTable? If so, then: object value = dataTable.Rows[int rowIndex][string columnName] from your example: object value = dataTable.Rows[3][4]; ...should do it. If you're talking about HTML tables, then it would depend on how the table was created. If you're doing it in code, then you should be able to walk the page's control hierarchy to get at it. If it's static HTML, javascript can do it, but it's kind of a long-winded answer unless you need it, and the question belongs in a different forum. Good luck.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    -- modified at 2:19 Monday 22nd May, 2006

    C# tutorial question

  • getting column from the dataset
    T turbochimp

    Do you really mean 'one column', or do you mean 'one value from a particular row'? If you really mean 'one column', then: DataColumn column = dataSet.Tables[string tableName].Columns[columnName] or DataColumn column = dataSet.Tables[int tableIndex].Columns[int columnIndex] If, however, you want the value stored for a particular column in a particular row in a table, then you need to index both the row and the column to get it: object value = dataSet.Tables[string tableName].Rows[int rowIndex][string columnName (,DataRowVersion rowVersion)] for example (the first method returns the current value in the described row's value list): public object GetValueInRow( DataSet ds, int tableIndex, int rowIndex, string columnName) { return GetValueInRow(ds, tableIndex, rowIndex, columnName, DataRowVersion.Current); } public object GetValueInRow( DataSet ds, int tableIndex, int rowIndex, string columnName, DataRowVersion rowVersion) { return ds.Tables[tableIndex].Rows[rowIndex][columnName, rowVersion] } Good luck.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    -- modified at 2:16 Monday 22nd May, 2006

    Database question

  • select command..
    T turbochimp

    This will also work, if I understand your question correctly (i.e. you want to know what staff members do not have a corresponding record in the login table):

    SELECT
        s.sname
    FROM
        staff s
    WHERE
        s.sname NOT IN (SELECT name FROM login)
    

    or this...

    SELECT
        s.sname
    FROM
        staff s
    WHERE
        NOT EXISTS (SELECT 1 FROM login l WHERE l.name = s.sname)
    

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    Database database help

  • double v. Double?
    T turbochimp

    I agree, there is a different conception of the shorthand 'int' between classic C and managed languages using the common type system, since the CTS doesn't consult the system on which it's compiled to see what size an integer should be. However that's not the same as saying 'int' will always represent a 32 bit integer. I think the idea is that if, say, 64 bit systems became the standard, 'int' might eventually map to Int64. Obviously, that would require a release of the framework (or at least the CTS), but the possibility definitely exists, and there are numerous warnings to that effect in the documentation. In such a case, source compiled using 'int' could take on a different meaning than code written using the (more explicit) 'Int32' under the updated type system. That said, do I typically fully qualify all of my integral type declarations? No, not really. Do I lay awake nights worrying about it? No, not really. :)

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# question

  • Run-on commands
    T turbochimp

    That's intuitively what I would expect, but I'm not certain it's what always happens. I should clarify somewhat by pointing out that my observations have been made with Oracle 9i, not SQL Server. The reason I'm not sure orphaned connections are always cleaned up neatly and efficiently is based on two main points: 1. I've watched from the DB side as connections were created from ASP.Net applications, during the execution of which the client browser was either closed or directed to a different (and unrelated) URL. The connections have not always dropped gracefully. 2. This is more of a gap in my knowledge than anything, but it seems as if there's a point in the execution of a SQL command from any application client where control is passed to the DB server to complete the work and return results across the pipe. In ASP.Net, where the (OS) process creating the connection is tied to the application, not the client browser, and is not terminated merely because the browser closes. In such cases, it appears as if the message pipe might be broken with regard to returning results to the end client, but the process under which the work is being performed is alive and well. Thanks for your input. If possible, could you provide some information on how you structured your tests? I'll be doing some of my own, so I'd be curious to see what you did.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    Database database question csharp asp-net sysadmin

  • Run-on commands
    T turbochimp

    Okay, this may be a really stupid question, but sitting here and thinking about it, followed by a large number of Google attempts has left me unenlightened. Here goes: Let's say I have an ASP.Net web application that displays a report to users using a datagrid. The query for the report is fairly complex and involves several joins using either poorly- or non-indexed tables containing hundreds of thousands of rows each. Suffice it to say, the query is long-running, which is not the greatest thing to have in a web application, but that's not really the point of my question. Now, let's say an impatient user signs in to the application and requests the slow report described above. The server-side application logic opens a connection, generates a command for the report, and executes it against the database server. The user drums his fingers on his desk for a while, whistles for a few minutes after that, and finally says "Something must be wrong!" and stabs the 'Submit' button to generate the report again (causing a new request against the web server, causing another command to be created and executed etc.). A minute passes and the query has still not returned... The user, now completely disgusted, closes his/her browser and goes to lunch. Now the question: What happens to the two commands - in fact two *connections* - that are presumably executing at the database server? They were both created under the main process of the ASP.Net worker account, and the process has not disappeared, however there is no longer anyone listening for the command to complete and return (either the browser is closed or the user has browsed away). Do the queries complete and return (to nowhere)? (no idea) Is the database server somehow signalled that the commands have been 'orphaned'? (doubt it) Do the commands, now presumably with a broken communication pipe the the client that requested their execution, sit until timeout occurs? Is the end nigh, and should I try to find a cool, dry place to watch Armageddon? The reason I ask is that I've observed similar issues in cases where a user posts a request for data from a long-running command, then closes his/her browser thinking that opening a new browser will make things go faster, only to find out that the DB server is almost completely unresponsive. I have also observed it from the DB server side, where there are large numbers of processes, alive and taking up CPU time, but never seeming to complete. Thanks for any input.

    Database database question csharp asp-net sysadmin

  • My Validator Controls don't work everywhere !
    T turbochimp

    Check to make sure your "production" server has the appropriate scripts in the [web root]\aspnet_client\system_web\[framework version number] directory, e.g. C:\Inetpub\wwwroot\aspnet_client\system_web\1_1_4322 There should be a couple of them in there, at least for framework 1.1: SmartNav.js WebUIValidation.js as well as SmartNav.htm I've run into this using a third party host once before. Good luck

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    ASP.NET sysadmin help question

  • cannot launch exe from windows service??
    T turbochimp

    Well, are you logging events on the service? If so, are there errors getting logged? Do you know for certain that the executable is not getting started? I don't know what it is you're trying to do, or what the executable is, so it's hard to make suggestions, but if you don't have some form of logging in place, then I would recommend adding some and seeing if anything comes of it. Good luck.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# help tutorial question

  • getting the size of an image from DB
    T turbochimp

    If you don't want to try to automatically scale the image, you could also try putting the image control inside a Panel with scrollbars and a fixed size. As for getting the size of the image, that should not be too hard - if you're retrieving it from a database, you'll have to load the image from a stream, so you should be able to check the length of the byte array fetched from the table.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    Database question csharp database help

  • cannot launch exe from windows service??
    T turbochimp

    Have you tried setting up the service to run as a specific user account, for instance the account you used to confirm that the EXE would start successfully? You should only do that as a test, by the way. If it does turn out to be a permission issue, a new account or group should be created with the least necessary permission(s) to use the EXE.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# help tutorial question

  • Convert web page to user control...
    T turbochimp

    You can actually just cut and paste the html and web control declarations to the user control's design interface. The javascript too, if it's inline; if not (if you are importing a .js file or something) you can leave the reference on the page that will act as parent to the user control. User controls do not need a HEAD or BODY element (nor should you add a new server-side FORM element to them) because they are provided by the web form (aspx file) on which the user control is sited. User controls (ascx files) are rendered as if they were part of the parent web form (aspx file). The difference (and advantage) between user controls and web forms is that user controls can be used in numerous places without having to either rewrite or cut/paste/customize large chunks of markup and controls. User controls also support code-behind or code-inline. For most purposes, you can think of them as web forms that cannot be rendered by themselves, but must be declared or hosted in the source of a web form. Once your user control is complete and working, you can literally drag and drop it on one or more web forms, and it should work the same in all cases, provided you've designed it without dependencies on its hosting environment. Good luck.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    ASP.NET javascript database question

  • Prevent Treeview (2.0) from posting back...
    T turbochimp

    Has anyone come across a way to prevent the ASP.Net 2.0 Treeview web control from posting back on select? I know you can set the select action for the node to 'None', but then you are forced to use checkboxes to determine selected items, which is also not attractive for my purposes, since I don't want to allow multiselect. Basically, I want the same kind of functionality that is currently available from ListBox, but I need to display hierarchical data (so, really, I'm describing the IE Treeview control, I guess). The problem arises from a Treeview with (potentially) several thousand nodes in it. Each time one is selected, the page posts back forcing the entire tree to render again, which is prohibitively slow. Anybody with ideas, bring 'em on. Thanks

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    -- modified at 0:58 Tuesday 10th January, 2006

    ASP.NET csharp asp-net data-structures help question

  • TypeLib for interop assembly changes case of method name
    T turbochimp

    I'm cross-posting this here since there seems to be a much livelier discussion of interop on this thread than on either the COM or .Net Framework threads. Apologies in advance to any offended parties. I have a scenario similar to the following: Assume a single assembly (SomeAssembly.dll) contains the following types: 1. Class B inherits from class A 2. Class A implements properties Moe, Larry and Curly, all of type ArrayList. 3. Class B implements a public interface containing all of the public members of both classes A and B. The problem: I export the type library for SomeAssembly.dll using

    Regasm.exe SomeAssembly.dll /tlb:SomeAssembly.tlb /codebase
    

    When I view the generated type library, I see that while properties Moe and Larry appear as "Moe" and "Larry" (their proper case is preserved), property Curly is exported as "curly" (all lower case). So far, I haven't been able to find an explanation for this behavior, and while the CCW works just fine, the name change is a little disconcerting for my client. The only similar article I was able to find referenced a known issue whereby if there was another "curly" property that was written to the type library first, all following same-named properties would bear the lowercase name, but there is only one "Curly" property in my assembly. Any ideas? Failing a solution, is there any attribute decoration I might use to force the proper case in the generated type library? Thanks.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    C# com help csharp dotnet question

  • TypeLib for interop assembly changes case of method name
    T turbochimp

    I have a scenario similar to the following: Assume a single assembly (SomeAssembly.dll) contains the following types: 1. Class B inherits from class A 2. Class A implements properties Moe, Larry and Curly, all of type ArrayList. 3. Class B implements a public interface containing all of the public members of both classes A and B. The problem: I export the type library for SomeAssembly.dll using

    Regasm.exe SomeAssembly.dll /tlb:SomeAssembly.tlb /codebase
    

    When I view the generated type library, I see that while properties Moe and Larry appear as "Moe" and "Larry" (their proper case is preserved), property Curly is exported as "curly" (all lower case). So far, I haven't been able to find an explanation for this behavior, and while the CCW works just fine, the name change is a little disconcerting for my client. The only similar article I was able to find referenced a known issue whereby if there was another "curly" property that was written to the type library first, all following same-named properties would bear the lowercase name, but there is only one "Curly" property in my assembly. Any ideas? Failing a solution, is there any attribute decoration I might use to force the proper case in the generated type library? Thanks.

    The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

    .NET (Core and Framework) com help question
  • Login

  • Don't have an account? Register

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