Perhaps something like :-
Code:
// Codehimbelonga kdub
private void button1_Click(object sender, EventArgs e)
{
string tbVal = (textBox1.Text);
if (String.IsNullOrEmpty(tbVal.Trim()) == false)
{
if (listBox1.SelectedIndices.Count > 0)
{
int selectedIndex = listBox1.SelectedIndices[0];
// if before selected
if (this.radioButton1.Checked)
{
listBox1.Items.Insert(selectedIndex, tbVal);
}
// if after selected
else if (this.radioButton2.Checked)
{
listBox1.Items.Insert((selectedIndex + 1), tbVal);
}
}
else
{
listBox1.Items.Add(tbVal);
}
}
}