저는 C#에 매우 익숙해졌습니다. 그래서 이것은 매우 쉬운 문제이지만, 모든 독서 후에도 Visual Studio 2010에서 필요로하는 정의를 추가 할 방법이 없습니다. using 문과 각 참조에 대한 MSDN 문서 페이지의 참조가 추가되었습니다.참조가 추가 된 후에 정의가 포함되지 않음
내 오류 :
System.windows.forms does not contain a definition for document
은 내가 마이크로 소프트 사이트에 읽고 있던 무언가를 기반으로 참조 "presentationframework"를 추가했다. 아래의 몇 가지 코멘트 덕분에 상자에서 텍스트를 가져 오는 두 가지 방법이 혼합되어있는 것 같습니다. 내가 할 수 있기를 원하는 것은 텍스트 박스에 내용을 붙여 넣기하고, 버튼을 누를 때 상자의 내용을 가져 오는 것입니다. 누군가가 전략을 혼합하지 않고서 어떻게 이것을 할 수 있을지 명확히 말해 줄 수 있습니까?
에서 Form1.cs :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Controls.RichTextBox;
using System.Windows.Forms;
using System.Windows.Controls;
using System.Collections;
namespace WindowsFormsApplication1
{
public partial class HackController : Form
{
ArrayList ipList = new ArrayList();
ArrayList acctList = new ArrayList();
int myAcct = 0;
string myIp = "";
public HackController()
{
InitializeComponent();
}
public void sync_Click(object sender, EventArgs e)
{
string data = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd).Text;// ERROR HERE
string[] lines = Regex.Split(data, "\n");
Regex ipMatch = new Regex(@"\d+.\d+.\d+.\d+");
Regex acctMatch = new Regex(@"#\d+");
foreach(string line in lines)
{
foreach(Match m in ipMatch.Matches(line))
{
ipList.Add(m);
}
foreach(Match m in acctMatch.Matches(line))
{
acctList.Add(m);
}
}
}
}
}
'.Split' 또한 문자열에 기본 구조체'string'을 사용합니다. – Sam
'using System.Windows.Forms; '를 제거해보십시오.'rtb'는'System.Windows.Controls.RichTextBox'가 아닌'System'이어야합니다. Windows.Forms.RichTextBox' –
@YuliamChandra, 내가 제안한 것을 시도했지만 문제가 해결되지 않았습니다. .Forms를 제거하면 pulic 부분 클래스로 오류가 발생합니다. 전체 클래스를 포함하도록 코드를 업데이트합니다. – Rilcon42