Mitja Bonca 557 Nearly a Posting Maven

Put a break point before this line of code:
Dim text As String = rid(2).ToString()

and you will see by putting a mouse cursor over "text" variable if there is any text iside.
If it is , it code should put text into comboBox, else its something wrong with query statement.

Mitja Bonca 557 Nearly a Posting Maven

Ok, I did renovate your code, and it you have data inside your table (and it connection string is the right one), is must work:

Private Sub ComboBox3_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)
    con = New OleDbConnection("Provider= Microsoft.ACE.oledb.12.0; Data Source=C:\Users\edenzam\Desktop\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb")
    Dim ewaaa As String = "SELECT * FROM Schedulings WHERE YearLevels = '" & ComboBox3.SelectedItem.ToString() & "' AND Sections = '" & ComboBox1.SelectedItem.ToString() & "'"
    com = New OleDbCommand(ewaaa, con)
    con.Open()
    rid = com.ExecuteReader()
    If rid.Read() Then
        Dim text As String = rid(2).ToString()
        ComboBox3.Items.Add(text)
        '2 means 3rd column! do you have 3 columns inside table?
        'show this on top:
        ComboBox1.Text = text
            'Interaction.MsgBox("Section Already Exist", MsgBoxStyle.Critical, "Error");               
        ComboBox3.SelectedIndex = -1
            ' do nothing
    Else
    End If
End Sub
Mitja Bonca 557 Nearly a Posting Maven

1st, why use use Validating event? Why not SelectedIndexChnaged (of comboBox(es))?
2nd, change comboBoxX.Text with comboBoxX.SelectedItem.tostring()
3rd, remove "if(rid.HasRows)" out of the code, change it with "if(rid.Read())" statement
and last,:
You cannot use comboBox3.Text, this will do nothing. What you can do, is to ADD a new Item to this comboBox. And then select it (if you want to show it on top (in "textBox" of comboBox area).
So change ComboBox3.Text = rid(2) to: ComboBox3.Items.Add(rid(2).ToString())

--
Hope it helps,
bye

Mitja Bonca 557 Nearly a Posting Maven

private List<string> list = new List<string>();
public List<string> List
{
get { return list; }
set { list = value; }
}

Mitja Bonca 557 Nearly a Posting Maven

or:

TimeSpan ts = DateTime1.Subtract(DateTime2); //date1 is newer then date2
Mitja Bonca 557 Nearly a Posting Maven

Thx for reminding me (it really was a type). Here is repaired code:

var query = descQuantity.Where(w=>w.Price >= 250M && w.Price <= 550M).Select(s => new Invoice { Id = s.Id, Name = s.Name, Quantity = s.Quantity }).ToList();
Mitja Bonca 557 Nearly a Posting Maven

Try using liqn with lambd
a expressions:

var query = descQuantity.Where(w=>w.Price => 250 && w.Price <= 550).Select(s => new Invoice { Id = s.Id, Name = s.Name, Quantity = s.Quantity }).ToList();

I dont know you actaul properties of the Invoice class, so rename them (inside brackets).

Mitja Bonca 557 Nearly a Posting Maven

We need more info. Is your comboBox bound to some datasource?

Mitja Bonca 557 Nearly a Posting Maven

clear comboBox2 before loading it:
comboBox1.Items.Clear()

Mitja Bonca 557 Nearly a Posting Maven

Sure, change if loops with while.

Mitja Bonca 557 Nearly a Posting Maven

For using MonthCalendar control and when you want to go 1 month forward and backward when pressing buttons:

Private Sub button1_Click(sender As Object, e As EventArgs)
    '1 month forward
    Dim [date] As DateTime = monthCalendar1.SelectionStart
    monthCalendar1.SelectionStart = [date].AddMonths(1)
    monthCalendar1.SelectionEnd = monthCalendar1.SelectionStart
End Sub

Private Sub button2_Click(sender As Object, e As EventArgs)
    '1 month backward
    Dim [date] As DateTime = monthCalendar1.SelectionStart
    monthCalendar1.SelectionStart = [date].AddMonths(-1)
    monthCalendar1.SelectionEnd = monthCalendar1.SelectionStart
End Sub

In case if you want use to select only one day, dont forget to set property "monthCalendar1.MaxSelectionCount" to 1 on load time.

Mitja Bonca 557 Nearly a Posting Maven

Ok, I mess around a bit with the code you want to, and this is what came out.
I hope you like it:

public partial class Form1 : Form
{
    DataTable table;
    public Form1()
    {
        InitializeComponent();
        //I will create this code in form`s constructor, so you will see it when form shows up

        //creating and setting dgv:
        DataGridView dataGridView1 = new DataGridView();
        dataGridView1.Location = new Point(20, 20);
        this.Controls.Add(dataGridView1);
        dataGridView1.AutoSize = true;
        dataGridView1.AllowUserToAddRows = false;
        dataGridView1.RowHeadersVisible = false;

        //creating datatable:
        table = new DataTable();
        for (int i = 1; i < 7; i++)
        {
            table.Columns.Add(string.Format("c{0}", i), typeof(int));
            table.Rows.Add();
        }

        //main code for sorting numbers in your way:
        int[] nums = Enumerable.Range(1, 36).ToArray();
        int x = 2, y = 3;
        int[] steps = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5 };
        int number = 1;
        int side = 1;
        //sides: 1 = right, 2 = up, 3 = left, 4 = down

        //lets insert 1st starting number:
        InsertNumber(x, y, nums[0]);
        for (int i = 0; i < steps.Length; i++)
        {
            SettingSteps(steps[i], ref side, ref number, ref x, ref y);
            if (side == 4)
                side = 1;
            else
                ++side;
        }
        //setting datasource to datagridview to show result:           
        dataGridView1.DataSource = table.DefaultView;
        for (int i = 0; i < dataGridView1.Columns.Count; i++)
            dataGridView1.Columns[i].Width = 30;
    }

    private void SettingSteps(int steps, ref int side, ref int num, ref int x, ref int y)
    {
        for (int i = 0; i < steps; i++)
        {
            switch (side)
            {
                case 1: x++; break; …
Mitja Bonca 557 Nearly a Posting Maven

And how is this sorted? I dont see any sortig there on that image.

Its only somekind of a table with numbers inisde - which start from the middle box and they go out?

If I understand you, you have an array of numbers, from 1 to 36, and you would like to show them in this kind of order?

Mitja Bonca 557 Nearly a Posting Maven

This is the code you need:

   For Each row As DataGridViewRow In dataGridView1.Rows
    Dim timeOut As Object = dataGridView1("Timeout", row.Index).Value
    Dim timeIn As Object = dataGridView1("Timein", row.Index).Value
    If timeOut Is Nothing Then
        dataGridView1.Rows(row.Index).DefaultCellStyle.BackColor = Color.Red
    ElseIf timeOut IsNot Nothing AndAlso timeIn IsNot Nothing Then
        dataGridView1.Rows(row.Index).DefaultCellStyle.BackColor = Color.Green
    End If
Next

Hope it will do any good.
bye

Mitja Bonca 557 Nearly a Posting Maven

do:

Private rtb1 As RichTextBox
Private Sub button1_Click(sender As Object, e As EventArgs)
    rtb1 = New RichTextBox()
    rtb1.Name = "rtb1"
    rtb1.Size = New Size(300, 200)
    'set it
    rtb1.Location = New Point(20, 20)
    'set it
    Me.Controls.Add(rtb1)
End Sub
Mitja Bonca 557 Nearly a Posting Maven

"value" in your case, must be a number.

  1. Or to pass number directly:

    Dim sqls As String = "UPDATE album SET quantity_available= quantity_available - 1 WHERE quantity_available=1"

which is in no good, if your parameter is changing (normally is does)

  1. Or you create a parametrized query:

    Dim sqls As String = "UPDATE album SET quantity_available= quantity_available - 1 WHERE quantity_available=@parameter1"
    Dim conn As New SqlConnection("connString")
    Dim cmd As New SqlCommand(sqls, conn)
    cmd.Parameters.Add("@parameter1", SqlDbType.Int).Value = 1 'declaring parameter
    'or pass some integer variable instead, like:
    'int myValue = 2;
    'cmd.Parameters.Add(@"parameter1", SqlDbType.Int).Value = myValue;

Hope it helps,bye

Mitja Bonca 557 Nearly a Posting Maven

Use this:

Imports System.Runtime.InteropServices
Imports System.Text

Namespace Ini
    ''' <summary>
    ''' Create a New INI file to store or load data
    ''' </summary>
    Public Class IniFile
        Public path As String

        <DllImport("kernel32")> _
        Private Shared Function WritePrivateProfileString(section As String, key As String, val As String, filePath As String) As Long
        End Function
        <DllImport("kernel32")> _
        Private Shared Function GetPrivateProfileString(section As String, key As String, def As String, retVal As StringBuilder, size As Integer, filePath As String) As Integer
        End Function

        ''' <summary>
        ''' INIFile Constructor.
        ''' </summary>
        ''' <PARAM name="INIPath"></PARAM>
        Public Sub New(INIPath As String)
            path = INIPath
        End Sub
        ''' <summary>
        ''' Write Data to the INI File
        ''' </summary>
        ''' <PARAM name="Section"></PARAM>
        ''' Section name
        ''' <PARAM name="Key"></PARAM>
        ''' Key Name
        ''' <PARAM name="Value"></PARAM>
        ''' Value Name
        Public Sub IniWriteValue(Section As String, Key As String, Value As String)
            WritePrivateProfileString(Section, Key, Value, Me.path)
        End Sub

        ''' <summary>
        ''' Read Data Value From the Ini File
        ''' </summary>
        ''' <PARAM name="Section"></PARAM>
        ''' <PARAM name="Key"></PARAM>
        ''' <PARAM name="Path"></PARAM>
        ''' <returns></returns>
        Public Function IniReadValue(Section As String, Key As String) As String
            Dim temp As New StringBuilder(255)
            Dim i As Integer = GetPrivateProfileString(Section, Key, "", temp, 255, Me.path)
            Return temp.ToString()

        End Function
    End Class
End Namespace
Mitja Bonca 557 Nearly a Posting Maven

error appering by:

.ExecuteNonQuery()
t says this:
ncorrect syntax near the keyword 'unique'.

unique is a column name in your database. maybe he only gave you an example name, you have to change it to your actaul column name!

Mitja Bonca 557 Nearly a Posting Maven

There is no such events like doubleClick or DateSelected, like monthCalendar control has.
So I would suggest you to take MonthCalendar control, and use DateSelected event.
What do you think?

Mitja Bonca 557 Nearly a Posting Maven

You want to hide.... ok!

When do you want to show it up again?

You could createa class boolean flag, and with it determine when to hide it for n clicks (1,2,..n), or when to hide it forever.

Mitja Bonca 557 Nearly a Posting Maven

Try do use StreamReader class to read the file line by line, and count repetitions of char:

Dim counter As Integer = 0
Using sr As New StreamReader("filePath")
	Dim line As String
	Dim data As String() = Nothing
	While (InlineAssignHelper(line, sr.ReadLine())) IsNot Nothing
		If line.Contains("*"C) Then
			data = line.Split(New Char() {"*"C}, StringSplitOptions.None)
			counter += data.Length - 1
		End If
	End While
End Using
MessageBox.Show("char * was counted: " & counter & " times")
Mitja Bonca 557 Nearly a Posting Maven

I see, sorry.
On new form put textboxes. On form where DGV is, create an array of data (of selected row) and paste to new form and show data from array in textBoxes.
Exmple:

Dim data() As String = New String((dataGridView1.Columns.Count) - 1) {}
For Each row As DataGridViewRow In dataGridView1.SelectedRows
    Dim i As Integer = 0
    Do While (i < row.Cells.Count)
        data(i) = row.Cells(i).Value.ToString
        i = (i + 1)
    Loop
    Exit For
    'only 1st selected row will be used (you can remove it)
Next
Dim f2 As Form2 = New Form2(data)
'on form2:
Class Form2
    
    Public Sub New(ByVal data() As String)
        MyBase.New
        textBox1.Text = data(0)
        'and so on...
    End Sub
End Class
Mitja Bonca 557 Nearly a Posting Maven

You went to right direction saleem, but you should only use DataGridViewRow class.
Why? You cannot select more then 1 row, since you only have 1 textBox for each column (so array of rows drops off here).
You can do:

Dim row As DataGridViewRow = dataGridView1.SelectedRows(0)
txtHotelId.Text = row.Cells(0).Value.ToString()
txtHotelName.Text = row.Cells(1).Value.ToString()
txtContactPerson.Text = row.Cells(2).Value.ToString()
txtLocation.Text = row.Cells(3).Value.ToString()
txtPhone.Text = row.Cells(4).Value.ToString()
TxtFax.Text = row.Cells(5).Value.ToString()
txtEmail.Text = row.Cells(6).Value.ToString()
txtAddress.Text = row.Cells(7).Value.ToString()
Mitja Bonca 557 Nearly a Posting Maven

Because the value of MyInteger changed, and would, therefore change the return value of MyMethod(), does it actually change it, or is MyValue still false after MyInteger gets a new value?

I understand completely.
When your "MyValue" variable get new value of true, false is no longer available.
The MyValue get changed instantly when you assign to it in another method - if this is what you would like to know (ones again, its get overwritten in the moment you assign new value to "return true", or "return false".

Mitja Bonca 557 Nearly a Posting Maven

When you call Dispose() method on some object, it means it is completey shuted down (you can understand it to be more then Closed - while closed object you can still access to it with its reference).
So Disposed objects are like then is no reference to them (not exisitng anyhow, and anylonger).

Concerning your example, your reference of a class must be an the class level, not on event level (now you create a new reference of the new form every time you click on the button).

Look at darkagn example, but you can still do it like:
Project1.Form1 prjform = new Project1.Form1(); //on class level you instanitate reference of a form (it will be done jsut before form load

private void mouseClkbtn_Click(object sender, EventArgs e)
        {
              if (mouseClkbtn.Text == "Latch Enable")
                {                   
                    prjform.Show();
                    mouseClkbtn.Text = "Latch Disable";
                }
                else if (mouseClkbtn.Text == "Latch Disable")
                {
                    prjform.Hide();
                    prjform.Dispose();
                    mouseClkbtn.Text = "Latch Enable";
                }            
        }
Mitja Bonca 557 Nearly a Posting Maven

any why would you like to get previous value? There is no sence.
Anyway, if you wanna hold multiple values in one variable, I would suggest you to use Dictionary (key will be index (like counter from 0,1,2, and up), while value will be an actual state of variable (in your case true and false will be chaging).
Example:

Dictionary<int, bool> dic = new Dictionary<int, bool>();
int counter = 0;
//inside your method:
private void DoWork()
{
     dic = MyMethod();
}

private Dictionary<int, bool> MyMethod()
{
    bool bFlag = true, or false; //swapping values...
    dic.Add(counter, bFlag);
    counter++; //rise it by 1 for next time round
    return dic;
}

Even MyMethod could return void, since dic variable is accessible in the whole class. Anyway, I only wanted to show an exmaple.
One more last thing: you can simply then loop through the dictionary and check the boolean states:

foreach(KeyValuePair<int, bool> kvp in dic)
{
    //in each iteration:
    int key = kvp.Key;
    bool bValue = kvp.Value;
}

Hope it helps.

Mitja Bonca 557 Nearly a Posting Maven

No, variable ONLY holds one value. So the last passed to it. If you "overwrite" false with true, there is no way to get false back. Only true is available.

Mitja Bonca 557 Nearly a Posting Maven

Your main problem was you only specify 3 value to be updates, then you add 4 parameters!

Next:
What exact data type are the columns in the data table?
My assumption:
- pic id - integer
- pic - image (you must pass a byte array to db)
- caption - varchar (50 length)

This is how you must have, and then you do:

byte[] ins = GetBinaryFile(txtDIR.Text);
int x = 1;
string comm = "INSERT INTO pictable (pic id, picDirectory, pic, caption) values(@picID, @picDirectory, @pic, @caption)";

OleDbCommand cm = new OleDbCommand(comm, cn);
cm.Parameters.Add("@picID", OleDbType.Int).Value = x; //no object casting!
cm.Parameters.Add("@picDirectory", OleDbType.VarChar, 50).Value = txtDIR.Text;
cm.Parameters.Add("@pic", OleDbType.Image).Value = ins;
cm.Parameters.Add("@caption", OleDbType.VarChar, 50).Value = txtCaption.Text;
cm.ExecuteNonQuery();

Hope it helps,
bye

Mitja Bonca 557 Nearly a Posting Maven

Impossible.
If you want to disable a control, you have to use "Enabled" property of a control. And it must be set to false.
Or you can even use "ReadOnly" property, which has to be set to true (to be disabled).

Mitja Bonca 557 Nearly a Posting Maven

TextChnaged event will not fire while pressing Enter key (carriage return).
To get this key pressed, you have to consider of using any of KeyPress events, like:
KeyDown:

c

or here is another option:

private void ByteData_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
    if (e.KeyChar == (char)13)
    {
         // Then Enter key was pressed
    }
}

If you still want to run the next code from TextChanged event, you can do something like:

private bool bFlag;
public void ByteData_TextChanged(object sender, EventArgs e)
{
     DataString.Append(ByteData.Text);
     if(bFlag)
     {
          //do your code in here after Enter key is pressed
     }
}

private void ByteData_KeyDown(object sender, KeyEventArgs e)
{
    if(e.KeyCode == Keys.Enter)
    {
        bFlag = true;       
    }
}

... but this is a lame way to do coding.
I would prefer to call the method (with additional code) directly from KeyDown event, when Enter key is pressed.

Hope it helps,
bye

Mitja Bonca 557 Nearly a Posting Maven

Use DataView class and RowFilter property of it, to specify the filter.
But before that fill the dataTable and use databinding (datatable has to be a binding source of datagridview control).

You can find an example here.
bye

Mitja Bonca 557 Nearly a Posting Maven

I'm sorry I'm still a beginner at this. What are "DAL" and "BL?"

never mind, do it this way:

//assembly 1:
namespace Mar14_Part1
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    public class MyClass
    {
        public string MyMethod()
        {
            return " some text from other assembly";
        }
    }
}

//assembly 2:
//add reference of assemby1 like I told you on top
then do:
using Mar14_Part1;

namespace Mar14_Part2
{
    class Program
    {
        static void Main(string[] args)
        {
            MyClass mc = new MyClass();
            string str = mc.MyMethod();
            Console.WriteLine(str);
            Console.ReadLine();
        }
    }
}

Mine example works!

Mitja Bonca 557 Nearly a Posting Maven

You can only reference in one way otherwise you get the error like you said. Just do this: delete the reference from your DAL to your BL and make a new one from your BL to your DAL!

Mitja Bonca 557 Nearly a Posting Maven

This is what you have to do exactly:

1.
The first step is to make P2 reference P1 by doing the following:

Right Click on the project and select "Add Reference";
Go to the Projects Tab (or Browse Tab);
Look for P1, Select it and hit OK;

2.
Next you'll need to make sure that the classes in P1 are accessible to P2. The easiest way is to make them public:

public class MyType { ... }

3.
Now you should be able to use them in P2 via their fully qualified name.
Assuming the namespace of P1 is Project1 then the following would work:

Project1.MyType obj = new Project1.MyType();

4.
The preferred way though is to add a using for Project1 so you can use the types without qualification:

using Project1;
...

public void Example()
{
MyType obj = new MyType();
}

Mitja Bonca 557 Nearly a Posting Maven

vshost file (in program/bin/debug)

Mitja Bonca 557 Nearly a Posting Maven

or this:

string dirPatgh = @"C:\MyFolder\";
DirectoryInfo di = new DirectoryInfo(dirPath);
// Get a reference to each file in that directory.
FileInfo[] files = di.GetFiles();
foreach(FileInfo file in files)
{
   listbox1.Items.Add(file.Name);
}
Mitja Bonca 557 Nearly a Posting Maven

You have to add a reference of the project you want to access to (right click on References in solution explorer, then select Add Reference, then select Browse tab and look for appropriate file in the project you want to access).
Then Add this reference on the top on the class you want to access from (using YourProjectname).
Then you should see the pulbic members of the class you access.

Mitja Bonca 557 Nearly a Posting Maven

Its not a bad idea to create (your own website, or some page of it) to point the help from your app. to it, like:

Help.ShowHelp(this, "http://www.helpware.net"); //this is exmaple url
Mitja Bonca 557 Nearly a Posting Maven

If you wanna see the image put some images (those you need9 into project - into the Resources).
Then you can create a switch statement, and based on an integer you will show appropriate image.
Or simply create an image from some file on the disc (by specifing the path to the image)

like:

int num = 1; //pass value to this variable
            Image img;
            switch (num)
            {
                case 1:  img = Bitmap.FromFile("path to image 1"); break;
                case 2: img = Bitmap.FromFile("path to image 2"); break;
                case 3: img = Bitmap.FromFile("path to image 3"); break;
                //and so on..
            }

This code will be used AFTER you will get the number (from 1 to 6) from some random class.
And use the image on the control (on some button and background image).

Mitja Bonca 557 Nearly a Posting Maven

This is a simple code, that creates an array of 4 integers, and addes a random number to each index.

Dim r As New Random()
Dim nums As Integer() = New Integer(3) {0, 0, 0, 0}
For i As Integer = 0 To 3
	If nums.Sum() <= 100 Then
		nums(i) = r.[Next](1, 101)
	Else
		nums(i - 1) = 0
		nums(i - 1) = 100 - nums.Sum()
		Exit For
	End If
Next
If nums.Sum() < 100 Then
	nums(3) = 100 - (nums(0) + nums(1) + nums(2))
End If
timosoft commented: Execellent +1
Mitja Bonca 557 Nearly a Posting Maven

HI just need a way to reset the DataAdapter1 into 0 (like reset)

Set datasource to null. This way you reser it.

Mitja Bonca 557 Nearly a Posting Maven

I cannot help you out, since I dont know what would those C, D and E mean.

Mitja Bonca 557 Nearly a Posting Maven

hmm another question is there any way for the form (or the windows) to make it resolution independent?

It actually cannot be fully independent, it always has to addapt on the screen resolution (it has to based on it). You can have app. in 1290 x 1500 (or what ever), and if your screen is in 1680 X 1050, then you will have sliders inside your application to view all the content. And this is not something we want.
And one more thing: you cannot never know the resolution of user, right?
But something is deffenatelly sure, if your app. is on max 800x600, there is no worries - noone has lower resolution any longer :)

But to be sure, you always can do the check of the current resolution and addapt your application (and all the controls inside) based on the measurement of the screen.

Does this make any sence?
Hope it does :)
bye

Mitja Bonca 557 Nearly a Posting Maven

You still didnt tell us any formula you want to use to get these kindof results.

Here is how you create and loop through multidimensional array:

Dim multiArray As Integer(,) = New Integer(,) {{5, 0, 10}, {0, 10, 0}, {10, 0, 34}}
Dim x As Integer = 0
For i As Integer = 0 To multiArray.GetLength(0) - 1
	For j As Integer = 0 To multiArray.GetLength(1) - 1
		x = multiArray(i, j)
	Next
Next
Mitja Bonca 557 Nearly a Posting Maven

have you heard of multidimensional arrays?
This is the answer here.
btw, how do we get those results (any formulas)?

Mitja Bonca 557 Nearly a Posting Maven

Thx, Im blushing :)

M.Waqas Aslam commented: sweet comment ahahhaahah :) u make me smile , +5
Mitja Bonca 557 Nearly a Posting Maven

Here is the solution (actually two of them):

'I have put 3 buttons on my form!!
Private buttons As Button()
Private pressedButton As Button
'OR:
Private _pressedButton As String
Public Sub New()
	InitializeComponent()

	'now lets create a common code for all:
	buttons = New Button() {button1, button2, button3}
	For i As Integer = 0 To buttons.Length - 1
		buttons(i).Name = "My button " & (i + 1)
		'specify name of the button
		buttons(i).Text = "Pres button " & (i + 1)
		'specify the text on the button
		buttons(i).Click += New EventHandler(AddressOf Buttons_Click)
	Next
End Sub

Private Sub Buttons_Click(sender As Object, e As EventArgs)
	Dim button As Button = TryCast(sender, Button)
	If button IsNot Nothing Then
		pressedButton = button
		_pressedButton = button.Name

		'show it here:
		RetreivePressedButton()
	End If
End Sub

Private Sub RetreivePressedButton()
	'you can call this method every time after click on button:
	MessageBox.Show("Pressed button was: " & Convert.ToString(pressedButton.Name) & ". And it still keeps this name in variable")
	'OR:
	MessageBox.Show("Pressed button was: " & _pressedButton & ". And it still keeps this name in variable")
End Sub
Mitja Bonca 557 Nearly a Posting Maven

Hi,
1st of all, you have to create an array of all buttons, accessible inside a class (or form).
Then use access to them with only one event:

Public Partial Class Form1
	Inherits Form
	'I have put 3 buttons on my form!!
	Private buttons As Button()
	Public Sub New()
		InitializeComponent()

		'now lets create a common code for all:
		buttons = New Button() {button1, button2, button3}
		For i As Integer = 0 To buttons.Length - 1
			buttons(i).Name = "My button " & (i + 1)
			'specify name of the button
			buttons(i).Text = "Pres button " & (i + 1)
			'specify the text on the button
			buttons(i).Click += New EventHandler(AddressOf Buttons_Click)
		Next
	End Sub

	Private Sub Buttons_Click(sender As Object, e As EventArgs)
		Dim button As Button = TryCast(sender, Button)
		If button IsNot Nothing Then
			MessageBox.Show("You pressed " + button.Name)
		End If
	End Sub
End Class
Mitja Bonca 557 Nearly a Posting Maven

for controls its more simple. Use ANCHOR property. By default, controls are set to top-left. Try to play with them a bit, and you will see what suits you most.

Mitja Bonca 557 Nearly a Posting Maven

You have to find our the screen resolution, and based on that, you then adjust your image (resize it).
How to get screen resolution and resize image:

Dim width As Integer = Screen.PrimaryScreen.WorkingArea.Width
Dim height As Integer = Screen.PrimaryScreen.WorkingArea.Height

Dim image__1 As Image = Image.FromFile("filePathToImage")
Dim newImage As New Bitmap(width, height)
Using gr As Graphics = Graphics.FromImage(newImage)
	gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
	gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
	gr.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality
	gr.DrawImage(image__1, New Rectangle(0, 0, width, height))
End Using
'now use newImage as background!