This is a simple data charting representation sample and simple datatable creation using C# and infragistic V10.2. Chart plays a big role in data representation for executives such as creating dashboards or revenue and census representation. I hope this simple sample program could help you on your charting issues. Don't forget to like, share and comment . Cheers! :D -ciao
This is a simple looping exercise. PL used : C#, VB.Net , VB6.
This is one of those exercises given to me when i was in my first year in programming. :D
VB 6
C Sharp
VB. Net
==== VB. Net language. This is also applicable and the same code for VB 6.
Public Class Form1
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
If txtInput.Text > 0 Then
Dim i As Double
Dim j As String : Dim str As String
j = "*"
For i = 1 To txtInput.Text
For xx = 1 To i
If xx <> i Then
str = str & j
Else
str = str & j & vbNewLine
End If
Next
txtDisplay.Text = str
Next
Else
Dim i As Double
Dim j As String : Dim str As String
j = "*"
For i = 1 To (txtInput.Text * (-1))
Dim jj As Double
jj = ((txtInput.Text * (-1)) - i) + 1
For xx = 1 To jj
If xx <> jj Then
str = str & j
Else
str = str & j & vbNewLine
End If
Next
txtDisplay.Text = str
Next
End If
End Sub
Private Sub txtInput_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInput.TextChanged
'If IsNumeric(txtInput.Text) = False Then
' txtInput.Text = String.Empty
' 'MsgBox("Numeric only!")
'End If
End Sub
Private Sub btnRevert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRevert.Click
If txtInput.Text > 0 Then
Dim i As Double
Dim j As String : Dim str As String
j = "*"
For i = 1 To txtInput.Text
Dim jj As Double
jj = (txtInput.Text - i) + 1
For xx = 1 To jj
If xx <> jj Then
str = str & j
Else
str = str & j & vbNewLine
End If
Next
txtDisplay.Text = str
Next
Else
Dim i As Double
Dim j As String : Dim str As String
j = "*"
For i = 1 To (txtInput.Text * (-1))
For xx = 1 To i
If xx <> i Then
str = str & j
Else
str = str & j & vbNewLine
End If
Next
txtDisplay.Text = str
Next
End If
End Sub
End Class
==== C # language. This is also applicable and the same code for C++.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Exercise1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnGo_Click(object sender, EventArgs e)
{
double i;
string j;
string str = "";
double val = Convert.ToDouble(txtInput.Text);
j ="*";
if (val > 0)
{
for (i = 1; i <= val; i++)
{
double xx;
for (xx = 1; xx <= i; xx++)
{
if (xx != i)
{
str = str + j;
}
else
{
str = str + j + Environment.NewLine;
}
}
txtDisplay.Text = str;
}
}
else
{
for (i = 1; i <= (val * (-1)); i++)
{
double jj = ((val * (-1)) - i) + 1;
double xx;
for (xx = 1; xx <= jj; xx++)
{
if (xx != jj)
{
str = str + j;
}
else
{
str = str + j + Environment.NewLine;
}
}
txtDisplay.Text = str;
}
}
}
private void btnRevert_Click(object sender, EventArgs e)
{
double i;
string j = "*";
string str = "";
double val = Convert.ToDouble(txtInput.Text);
if (val > 0)
{
for (i = 1; i <= val; i++)
{
double jj = (val - i) + 1;
double xx;
for (xx = 1; xx <= jj; xx++)
{
if (xx != jj)
{
str = str + j;
}
else
{
str = str + j + Environment.NewLine;
}
}
txtDisplay.Text = str;
}
}
else
{
for (i = 1; i <= (val * (-1)); i++)
{
double xx;
for (xx = 1; xx <= i; xx++)
{
if (xx != i)
{
str = str + j;
}
else
{
str = str + j + Environment.NewLine;
}
}
txtDisplay.Text = str;
}
}
}
}
}
Please leave a comment or suggestion about this post. Thank you. :D Cheers.