Hello everybody,

Ι want to make an application that does multiple mathematical actions such as solving second degree equations and indentities

I've created all the forms I need for it work but I cant create the main form that the user will use to choose what action will be executed,
the problem is that I don't know how to call the forms that I've made... (I've tried simply writing

formtaut2.Visible = True

as well as

formtaut2.Show()

but both of them throw an exception)
Any ideas?
Thanks in advance..

PS1. Sorry if this is a newbie but I'm one myself
PS2. Please excuse any grammatical errors

Yes, I have a marvelous idea.
If you want us to help you, why don't you send us some code and point to the line where the error occurs. For you it is very obvious what formtaut2 is, not so for us, so please be more specific in your questioning.

ok so.... formtaut2 is the form that I want to popup using a button in the main form called form1 the button is called button1

   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If ComboBox1.Text = "Ταυτότητα στο τετράγωνο" Then
           'In here I want to call the form : formtaut2
           End If

    End Sub

Do you somewhere in your code have a line that reads something like Form formtaut2 = new Form(); ?
I'm just guessing here, because you don't show more code.

I'm not showing more code because it is irrelevant.. The only code in the main form that is relevant is the segment that I posted(At least I dont think that the combobox code has anything to do with it)
No I don't.. All the programs I've written so far had only one form so this is new to me and when I searched for it I only found how to create an empty form which is not the case in this one... I want to call the form that I've coded(formtaut2) through the button's click.

Also the kind of exception is very relevant, you did not tell.
But as I see it ( again guessing ) you are trying to access fields and methods from an object (formtaut2) which is not created with new.
You have to perform somewhere in your code a line of code like Dim formtaut2 As Form = new Form();.
Hope it helps.

With the line you've mentioned you are creating a new 'empty' form.. I'd like to know if there is a way to add a predesigned form..

Main form : Form1
The form I want: formtaut2

PS. The error is this one

An unhandled exception of type 'System.InvalidOperationException' occurred in Tautothtes.exe

Additional information: An error occurred creating the form. See Exception.InnerException for details.  The error is: Object reference not set to an instance of an object.

The code on the formtaut2 is:
Also I've noticed that the error popup highlights the line with the a variable.

Public Class formtaut2
    'Dim formtaut2 As New System.Windows.Forms.Form
    Dim a As Integer = txt1oros.Text
    Dim b As Integer = txt2oros.Text
    Dim pros As Integer = txtpros.Text
    Dim apot As Double
    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub apottaut_Click(sender As Object, e As EventArgs) Handles apottaut.Click
        If pros = "+" Then
            apot = (a ^ 1 / 2) + 2 * a * b + (b ^ 1 / 2)
            MsgBox("Το αποτέλεσμα είναι: " & apot)
        ElseIf pros = "-" Then
            apot = (a ^ 1 / 2) - 2 * a * b + (b ^ 1 / 2)
            MsgBox("Το αποτέλεσμα είναι: " & apot)
        Else
            MsgBox("Χρησιμοποίησε '+' ή '-' !!!")
        End If
    End Sub
End Class

The last sentence ( Object reference not set to an instance of an object.) clearly indicates that no creation of the formtaut2 took place. You could examine InnerException to get extra info about the cause.
BTW, I made a project with a form with a button, when clicked it opens a second form, without a problem.

I've created all the forms I need for it work but I cant create the main form that the user will use to choose what action will be executed,

Click on MyProject which opens a new tab and there you can set the startup form that will be displayed when your program is started.

I finnaly made it.. The error was before my eyes the whole time

Dim a As Integer = txt1oros.Text
Dim b As Integer = txt2oros.Text
Dim pros As Integer = txtpros.Text

I was assigning those textboxes outside their sub so they couldn't be accessed
I fixed by just declaring them at the begginning and assigning their values withing the bttn code..
Thanks @ddanbe for you help
@Minimalist this wasn't an issue but thanks anyway!
@Everyone Merry Christmas!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.