Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Writing a 1040 EZ tax form in visual basic. I need help with writing a 1040 EZ f

ID: 3691728 • Letter: W

Question

Writing a 1040 EZ tax form in visual basic.

I need help with writing a 1040 EZ form in visual basic with these requirements

- It should allow the user to save their work and open it later.

- Allowing the user to print their taxes in an easily readable format that includes the address block, and both the line numbers from the form, as well as those amounts.

- Combo box for the user to select their state, a checkbox group for the Presidential Election Campaign, a radio group for 13c with the following options: (Check, Direct Deposit).

- File menu that allows the user to open, save or print.

- At least 1 loop 1 constant, 1 global, 1 module, 1 if-else statement, 1 switch statement, 1 procedure or method. And 2 or more forms.

Explanation / Answer

program :   private void SaveMenu_Click(object sender, System.EventArgs e)
{
saveFileDialog1.InitialDirectory = Application.ExecutablePath.ToString();
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
FileStream fs = new FileStream(saveFileDialog1.FileName, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
foreach (Control c in Controls)
{
string strType = c.GetType().ToString().Substring(c.GetType().ToString().LastIndexOf(".") + 1);
if (strType == "TextBox")
{
sw.WriteLine( ((TextBox)c).Text.ToString());
}
else if (strType == "CheckBox")
{
if (((CheckBox)c).Checked)
sw.WriteLine("1");
else
sw.WriteLine("0");
}
}
sw.Close();
fs.Close();
}
}
private void DrawAll(Graphics g)
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Far;
this.AutoScrollPosition = new Point(0,0);
RectangleF srcRect = new Rectangle(0, 0, pictureBox1.Image.Width, pictureBox1.Image.Height);
int nWidth = printDocument1.PrinterSettings.DefaultPageSettings.PaperSize.Width;
int nHeight = printDocument1.PrinterSettings.DefaultPageSettings.PaperSize.Height;
RectangleF destRect = new Rectangle(0, 0, nWidth, nHeight);
g.DrawImage(HiResImage, destRect, srcRect, GraphicsUnit.Pixel);
float scalex = destRect.Width/srcRect.Width;
float scaley = destRect.Height/srcRect.Height;
foreach (Control c in Controls)
{
string strType = c.GetType().ToString().Substring(c.GetType().ToString().LastIndexOf(".") + 1);
if (strType == "TextBox")
{
TextBox theText = (TextBox)c;
if (theText.TextAlign.ToString() == "Left")
g.DrawString(theText.Text, theText.Font, Brushes.Black, theText.Bounds.Left*scalex, theText.Bounds.Top *
scaley,
new StringFormat());
else
{
RectangleF LayoutRect = new RectangleF(theText.Bounds.Left*scalex, theText.Bounds.Top*scaley,
theText.Bounds.Width*scalex, theText.Bounds.Height*scaley);
g.DrawString(theText.Text, theText.Font, Brushes.Black, LayoutRect, sf);
}
}
if (strType == "CheckBox")
{
CheckBox theCheck = (CheckBox)c;
Rectangle aRect = theCheck.Bounds;
if (theCheck.Checked)
{
g.DrawString("x", theCheck.Font, Brushes.Black,
theCheck.Left*scalex + 1, theCheck.Top*scaley + 1, new StringFormat());
}
}
}
}