我已经浏览了这里的几篇文章,并且没有找到我找到的解决方案。我尝试从窗体a传递一个对象到窗体b,当你点击一个菜单项时,它给了我错误:不一致性可访问性:参数类型
错误1不一致的可访问性:参数类型'WindowsFormsApplication1.character'比方法'WindowsFormsApplication1.CharBuilder.CharBuilder(WindowsFormsApplication1.character)'
这里为发送形式:
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;
namespace WindowsFormsApplication1
{
public partial class GVL4 : Form
{
public GVL4()
{
InitializeComponent();
}
public void mNewGame_Click(object sender, EventArgs e)
{
character MyCharacter = new character();
MyCharacter.SetIsNew();
CharBuilder NewCharacter = new CharBuilder(MyCharacter);
NewCharacter.Show();
}
}
}
和接收形式:
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;
namespace WindowsFormsApplication1
{
public partial class CharBuilder : Form
{
character Char = new character();
public CharBuilder()
{
InitializeComponent();
}
//Overloaded Constructor
public CharBuilder(character cChar)
{
Char = cChar;
}
private void txtSect_TextChanged(object sender, EventArgs e)
{
}
private void btnSaveID_Click(object sender, EventArgs e)
{
if (Char.IsNew())
{
Char.SaveCharIdentity(txtCharName.Text, txtClan.Text, txtSect.Text, txtNature.Text, txtDemeanor.Text, txtTitle.Text, txtCoterie.Text, txtSire.Text, txtPlayerName.Text, txtCharacterID.Text, txtStatus.Text, Convert.ToInt32(txtUnspentXP.Text), Convert.ToInt32(txtEarnedXP.Text), Convert.ToInt32(txtGeneration.Text), Convert.ToInt32(txtBloodPool.Text), cbxNPC.Checked);
}
txtTestBox.Text = Char.ToString();
}
public void CharBuilder_Load(object sender, EventArgs e)
{
}
}
}
的错误是在重载(公共CharBuilder(字符CCHAR))
发布定义您的角色类的代码,这是问题的可能来源。 –