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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
F

flicktom

@flicktom
About
Posts
8
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Need help with a Struct or Class (array)
    F flicktom

    Great. That worked (with a minor edit... needed to replace student with ClassStudent). A recap for any that browse for a solution of this nature... // This, I actually placed after the "System Generated Object Declarations" for increased scope. ArrayList students = new ArrayList(); // The while loop... while (LogReader.Read()) { // Make a new student ClassStudent student = new ClassStudent(); // Fill it with data (Added some nullchecking since original post.. not shown) student.SetKnown(LogReader.GetInt32(0), LogReader.GetString(1)); // Now add the new student to the students arraylist students.Add(student); // Now students is filled with each student (duh), and you can still reference it // Now you can get a student like this: // With ArrayList you have to cast from object to a ClassStudent (my apologies for not catching this... thanks for pointing it out in more detail, Guffa :) ) // Can use this anywhere you like.. ((ClassStudent)students[indexNum]).MyMethod(); Thanks a "metric buttload" to both of you.

    C# help csharp database data-structures

  • Need help with a Struct or Class (array)
    F flicktom

    Ok. That 'kind of' works... I was able to declare the ArrayList "students", create a new class object "student", pass the values into the object "student" (as far as compile time goes.. can't really test it because of the following...) and add the object "student" to the ArrayList of "students". Ok so far. Now when I try to use the intellisense for "students." I don't get any of the functions that I need to be able to call from the class object that it is comprised of. Pretty pointless if I can't use the functions the whole class was designed for. Any suggestions? Here's a summary of what I need to accomplish... 1. read multiple records (with multiple fields of varying data types, of course) from a table in a database into an array of some sort. 2. While reading the rows, populate a listbox with a built sting with some of the information (but not all) // This much I can handle all well and dandy 3. I need to be able to pull up various elements from the 'full' array of data for a given line when a user clicks on one of the corresponding "index number" line in the listbox. 4. I had this licked with a handy-dandy "type" variable array in VB6, but C# is just TOTALLY not going to settle for the same approach. I need some advice on the best way to approach this problem. I've wasted over 8 hours already, trying to find a means for something that took me a whopping 20 minutes in VB6, and I feel no closer now than when I started.:sigh:

    C# help csharp database data-structures

  • Need help with a Struct or Class (array)
    F flicktom

    I have a C# problem that I need a solution for. I've pretty much mastered in in VB6, but keep running into brick walls, even with all the tutorials for C#. Here's the definition of the variables you're about to see... "ClassStudents" is a class I created to manage an array of students read in from... "LogReader" This is the name given to the SQL select statement that returns the information I'm trying to use. "logCount" is simply to keep the array element in check. while (LogReader.Read()) { ClassStudents[] Students = new ClassStudents[logCount+1]; Students[logCount].setKnown(LogReader.GetInt32(0), LogReader.GetString(1)..... logCount++; } Basically, I need to be able to populate an array of what in VB6 would be a simple 'Type' so I can go back to it for data 'after' the fact. Everything's fine until I leave the while loop, at which point I seem to lose the ability to reference the "Students" array I created. I tried using Structs as well. I know it must be a fundamental rule I'm breaking, but I just can't find any reference to what is happening in any documentation or help files. I found a post basically outlining the method I'm using, but they stop short of any reason why I wouldn't be able to access the data outside of where it was populated. Kinda defeats the purpose, if you ask me.

    C# help csharp database data-structures

  • Checkbox Arrays...
    F flicktom

    Ok... I found the C# tutorial on how to create a group of controls from a string array... Is this the only way to create and use an array of controls? I'd really much prefer to have them available at design time, not to mention having to plot their location every time I want to create another array of controls. I find it hard to believe that .NET would make something that seems so fundamental such a pain in the arse...

    C# question csharp data-structures

  • Checkbox Arrays...
    F flicktom

    Ok, this is a simple question, but I've tried and looked and just can't seem to come up with an answer... In my VB6 app, I can create an array of controls simply by copy and pasting for the default "do you want to make this object an array" prompt... In C#, I get no prompt, and no menu option (that I can see.. maybe I'm blind) to make an array. I simply want to be able to create an array of x number of checkboxes (or any control, for that matter) in a panel so I can cycle through them with an iteration statement... What am I missing? If this involves more code than using iteration would save, just tell me and I'll move on. Thanks in advance. :)

    C# question csharp data-structures

  • Login failure needs to close main app...
    F flicktom

    This solution worked great. Thanks.

    C# database regex help question

  • Sql Connection...
    F flicktom

    I was just boning up on the subject last night, and most DBMSs (if not the .NET itself) maintain a connection pool. This way, it can create how ever many connections it will dole out ahead of time, and assign them as needed, instead of performing the resource consuming actions to create them on the fly. Think of it like an old fashioned hotel switchboard operator's console.. they've got a certain number of outside connections all ready to go, but nothing directly connected to the rooms... When you call the operator, they just plug you in when you request an outside line. This is just the reason you "don't" want to use a static connection. Too many applications holding the line when they don't need it could lock up your DBMS for those that do. Flicktom

    C# performance help database beta-testing code-review

  • Login failure needs to close main app...
    F flicktom

    I have an MDI parent form "formMAIN" with the following code: public formMAIN() { InitializeComponent(); // blah blah blah LoginForm loginForm = new LoginForm(); loginForm.ShowDialog(); if (LoggedUserName != "") { this.Text += " [" + LoggedUserName + "]"; } else { // problem area... I want to close the main form if login failed... // IE... LoggedUserName will be "" } ... The loginForm connects to the database, checks for matching user name and password and sets the formMAIN's static variable "LoggedUserName" if a match is found. I placed it in the constructor of formMAIN so that it would appear first. I want to be able to close this main form immediately if the user closes the login form or clicks the "cancel" button on it... IE.. LoggedUserName will be blank when the focus returns to the formMAIN. I tried "this.Close();" as well as Application.Close(), but it doesn't work. I'm guessing this is because it's in the constructor for the form, which obviously is not yet completely instantiated. I can't put it in the initialize area for the same reason. I need some way to automatically perform the this.Close() operation 'after' the formMAIN completes initialization if the LoggedUserName value is still "" (IE.. failed log-in or user canceled the login form). How can this be done with the least amount of code? Flicktom -- modified at 0:23 Monday 12th December, 2005

    C# database regex 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