0
두 가지 형식이 있습니다. 하나는 목록 상자가있는 목록 상자입니다 (<). 두 번째 양식에서이 텍스트 상자의 선택한 항목에 액세스해야합니다.다른 항목에서 선택된 항목에 액세스합니다.
우선 형태 (GestaoJogadores_Admin)
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 GestaoJogadores_Admin : Form
{
private DiagramaEntidadesContainer dbATMT;
public GestaoJogadores_Admin()
{
InitializeComponent();
dbATMT = new DiagramaEntidadesContainer();
RefreshListaJogadores();
}
private void button_editarGestaoJogadores_Click(object sender, EventArgs e)
{
EditarJogador_Admin EditarJogadorAdmin = new EditarJogador_Admin();
Player jogadorSelecionado = (Player)lb_Jogadores.SelectedItem;
DialogResult resultado = EditarJogadorAdmin.ShowDialog();
}
}
}
두번째 형태 (EditarJogador_Admin)
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 EditarJogador_Admin: Form
{
private DiagramaEntidadesContainer dbATMT;
public EditarJogador_Admin()
{
InitializeComponent();
dbATMT = new DiagramaEntidadesContainer();
}
private void button_EditarJogadorOk_Click_1(object sender, EventArgs e)
{
GestaoJogadores_Admin GestaoJogadoresAdmin = new GestaoJogadores_Admin();
Player jogadorSelecionado = (Player)GestaoJogadoresAdmin.jogadorSelecionado;//this is what I need, but it doenst work. I get an errror: 'GestaoJogadores_Admin' does not contain a definition for 'jogadorSelecionado' and no extension method 'jogadorSelecionado' accepting a first argument of type 'GestaoJogadores_Admin' could be found (are you missing a using directive or an assembly reference?)`
}
}
}
은 내 두번째 형태 제 하나의 인스턴스를 생성하고이 ShowDialog를 사용하여 열. 두 번째에, 나는 내가 같은를하고있는 경우 "jogadorSelecionado"그 안에, 그것은 작동합니다 액세스하려고 생각하지만, 그것은 버튼의 변경에 첫 번째 양식에 ...
이 좋아, 그것은 작동하지만 지금은 지금 임 값이 null 오는지고 ... doenst..sorry. 플레이어 jogadorSelecionado = passFromFormOne; null입니다 ... –