Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:29:23+00:00 2026-05-16T18:29:23+00:00

Morning. Issue: I have a class called Reports. Two constructors. One allows no parameters,

  • 0

Morning.

Issue:
I have a class called Reports. Two constructors. One allows no parameters, the other a string array. The string array is supposed to be the reports they’d like to display. What I’d like to do is the following:

string strSQL = this.Queries[strReportName];

I have a feeling it’s possible because in the dataGridView I’m using, I get the column index by:

int nColumnIndex = dgvParts.Columns[strColumnName].Index;

Both of those examples use a string to determine what value in the array they retrieve, but I’m not sure how to do this. Can anyone give me some help? Any and all help is appreciated.

To the editors and mods: Yes, the reports part loosely ties to the other post I have about dynamically loading DLLs but I’d like to keep the other open still. My boss and I decided for the short term, we’ll just have a single DLL and everything is hard coded, but in the long run we want to dynamically drop in DLLs as reports, so please don’t tag this as a duplicate. I plan this weekend to try and implement the methods given to me in the other thread. Thanks.

Edit – Part 2 of the question: Ok, here’s my class as it is right now:

public class Queries
{
  #region Report Queries
    #region Missing Code
      string strMissingCode = "SELECT * FROM PARTS WHERE CODE IS NULL OR CODE = ''";
    #endregion
  #endregion
}

I’d like to change it to something like this:

public class Queries : Dictionary<string, string>
{
}

But I don’t want them to have to use a constructor to instantiate it. I want static of sorts so I can run code like this:

class Reports
{
  private List<ReportRecord> _lstRecrods = new List<ReportRecord>();
  public List<ReportRecord> Records { get { return _lstRecords; } }

  public Reports(string[] strDisplayedReports)
  {
    foreach (string strReportTitle in strDisplayedReports)
    {
      this.BuildReportList(strReportTitle);
    }
  }

  private void BuildReportList(string strReportTitle)
  {
    using (DataSet ds = Database.GetDataSet(Queries[strReportTitle]))
    {
      ...
    }
  }
}

How do I make it static of sorts to where I don’t have to instantiate Queries? Thanks guys and gals.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:29:23+00:00Added an answer on May 16, 2026 at 6:29 pm

    A Dictionary can use strings as the “index” (key, actually).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning. I've been having this issue for some days and have been lokking
I have been stuck with this issue now all morning. I actually saw this
Good morning all. I have an issue with a query. I want to select
I have an issue that's been bugging me this morning. I'm building an ASP.NET
This morning I am fighting with an issue. I need to have users fill
Good Morning Stack OverFlow enthusiasts. I have been having an issue that I am
Good Morning, I have an application which allows users to slide values for different
Morning Guys, I have a CSS issue that's driving me up the wall. I
Good morning! I Have an issue with a wysiwyg editor that saves html to
Morning folks. Have an issue with a simple jQuery gallery i'm making. It lets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.