Kalkulator w ONP połączony z DLL - Pytania do programu itd.?

0

Witam. Mam do wykonania kalkulator obiektowy w ONP w C# korzystającym z biblioteki DLL.
Niestety nie wiem jak w kodzie przekazać wartość z Text Boxa do funkcji ,której baza będzie w bibliotece.
Proszę o pomoc w tej sprawie.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ONPCalculator.Core
{
    public class CalculatorCore
    {
        Stack<String> stos = new Stack<string>();
        //stos.Add(textBox1.Text);
        string init;
        double Add(string liczba)
        {
            if (liczba.Equals('+') || liczba.Equals('-') || liczba.Equals('*') || liczba.Equals('/'))
            {
                Char.Parse(liczba);
                return Char.Parse(liczba);
            }
            else
            {
                Convert.ToDouble(liczba);
                //Double.Parse(liczba);

                return Double.Parse(liczba);
            }
        }

    }
}
// Biblioteka DLL

Biblioteka DLL

 
using ONPCalculator.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using CalculatorCore;

namespace ONPCalculator.UI
{
    public partial class Form1 : Form
    {
        char sign;
        string liczba;
        CalculatorCore calculator = new CalculatorCore();

        public Form1()
        {
            InitializeComponent();
        }

// ...
 private void buttonPlus_Click(object sender, EventArgs e)
        {
            textBox1.AppendText("+");
            liczba = textBox1.Text;
            calculator.Add(liczba);
            //pobierz_znak();
           // calculator.pobierz_znak.Add("+");
        }
// Fragment kodu źródłowego GUI

GUI
++_
Obecnie chciałbym przekazać wartość z text Boxa poprzez funkcję Add do funkcji w bibliotece DLL, by móc później np. wartości umieszczać na stosie. Lecz nie wiem jak to zrobić. Wyświetla się błąd:
Error 1 'ONPCalculator.Core.CalculatorCore' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'ONPCalculator.Core.CalculatorCore' could be found (are you missing a using directive or an assembly reference?) C:\Users\Patryk\Documents\Visual Studio 2012\Projects\Projekt1_Windows_Forms\Projekt1_Windows_Forms\Form1.cs 90 24 Projekt1_Windows_Forms

0

Oznacz metodę Add jako public. Bo jak na razie jest prywatna, więc niewidoczna w innych klasach.

0

Po zmianie na public to samo. Dodam, że referencja jest stworzona do projektu biblioteki dll. Projekt ten jest dodany do soluji. Teraz w solucji mam projekt główny z GUI oraz projekt z biblioteką.

1 użytkowników online, w tym zalogowanych: 0, gości: 1