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”

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.