Page 1 of 1

C# winform help

Posted: July 31st, 2017, 12:23 pm
by Zodac
I'm working on my first winform project and also my first C# project so i have no idea what i'm doing pretty much

One problem i have is calling a function from form1 on form2's FormClosing

I've looked it up and most posts are from 6-8 years old and i don't understand most of them but one thing i did understand is that i could make the function i'm trying to call static but i can't because then my OleDB connection is getting some problems

If anyone wants to take a look at the code i'll link it but 2 things, i'm writing this for a VS 2013 user and when i tried to run it using VS 2015 it just didn't work, and code is partially not written in english

If you still want to look at the code here it is
https://www.mediafire.com/?x7y5zqnr6pdmm8b


PS. specifically what I want to do is call the function dodajKorisnika() (from FormMain) when FormDodajKorisnika is closing

Re: C# winform help

Posted: August 1st, 2017, 8:06 pm
by Zedtho
Don't know if you'll get much help here, most of us use C++ here. Nonetheless, maybe someone does know the answer to your question.

Re: C# winform help

Posted: August 1st, 2017, 9:13 pm
by albinopapa
Yeah, i've tried looking through it, not too familiar with C# to begin with, but am getting a lot of trouble with exceptions with this function:

Code: Select all

        private void UpdatePonudaParameters(ReportViewer rv, string[,] Parameters)
        {
            //https://social.msdn.microsoft.com/Forums/en-US/693694bc-bfbc-4786-98ee-a99826e78739/difficulty-setting-reportparameter?forum=vsreportcontrols

            ReportParameter[] p = new ReportParameter[(Parameters.Length / 2)];
            for (int i = 0; i < (Parameters.Length / 2); i++)
            {
                p[i] = new ReportParameter(Parameters[i, 0], Parameters[i, 1]);
            }
            rv.LocalReport.SetParameters(p);  // <- this causes the exception saying the report is invalid
        }
Sorry, I don't have VS2013 installed anymore, nor VS2010. It took awhile to even get the error reporting stuff installed to even be able to build it.