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 7616541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:54:49+00:00 2026-05-31T02:54:49+00:00

i’m using C# to read info from an access database (works great, thx stackoverflow)

  • 0

i’m using C# to read info from an access database (works great, thx stackoverflow)
i’m trying to make a lined up text string so i can display it in textbox and later on print it as a string, not the best way, but it should work (if you think of a better option tell me)

public string ItemToString(int item_id)
        {
           string[] userString = new string[7];
           string retString=""; 
           cmd.CommandText = "select * from Item where item_id = " + item_id + "";

           con.Open(); // open the connection
           OleDbDataReader dr = cmd.ExecuteReader();
           while (dr.Read())
           {
               for (int i = 0; i < 7; i++)
                   userString[i] = dr[i].ToString();
           }
            con.Close();
            //string conection with spaces
            for (int i = 0; i < 7; i++)
            {
                retString += userString[i];
                for (int j = 0; j < 15-userString[i].Length; j++, retString += "  ") ;
            }
            return retString;
        }

this is the output (in hebrew) the first line is from other place, mind only lines 2-4 i added the red line to see where it’s “off”
output

  • 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-31T02:54:51+00:00Added an answer on May 31, 2026 at 2:54 am

    If you’re using non-proportional font (like courier), pad with spaces using any possible way. Get familiar with ToString() function and formats for padding, to make it easy.

    If you’re printing or displaying as graphics or proportional font, get familiar with Graphics.MeasureString. It lets you measure how many pixels the string will take, using given font and size. Then you can draw it in correct place. Measure the whole string and not single letters, if you don’t want to make it really complicated.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the

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.