这很简单但我找不到搜索谷歌的任何答案!
我在C#中试过这个
MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].ToString());
Run Code Online (Sandbox Code Playgroud)
这会返回行和列索引而不是单元格的值.
如何获得价值呢?
谢谢.
如果我想连接到Oracle,MySQL甚至MS Access怎么办?
我很惊讶甚至没有附加到datagridview的过滤器属性,我正在紧张,我可以找到过滤Datagridview的示例,这是以编程方式绑定的,我找不到任何关于如何过滤生成的datagridview的示例通过Visual Studio.
那么请有人告诉我如何过滤这些东西?
谢谢.
我只想反思:
using System;
using System.Collections.Generic;
using System.Reflection;
public class CTest {
public string test;
}
public class MyClass
{
public static void Main()
{
CTest cTest = new CTest();
Type t=cTest.GetType();
PropertyInfo p = t.GetProperty("test");
cTest.test = "hello";
//instruction below makes crash
string test = (string)p.GetValue(cTest,null);
Console.WriteLine(cTest.GetType().FullName);
Console.ReadLine();
}
}
Run Code Online (Sandbox Code Playgroud) 我在这里读到可以调用另一个构造函数从同一个类中的其他构造函数调用构造函数
但它在开始时调用另一个构造函数,而我想在最后调用.这可能吗 ?
要求具体的人的更新:在program.cs中,我希望能够做到,具体取决于某些情况
这个:
// Form1 will show a message from its own private member
Application.Run(new Form1());
Run Code Online (Sandbox Code Playgroud)
或这个:
// Form1 will show a message from class1 member (kind of overloading form1 message if class1 exists)
Application.Run(new Form1(new Class1()));
Run Code Online (Sandbox Code Playgroud)
我有Form1
private string member = "Test Sample if no class1";
Run Code Online (Sandbox Code Playgroud)
在class1我有
private string member = "Test Sample from class1";
public string member;
{
get { return this.member; }
set { this.member = value; }
}
Run Code Online (Sandbox Code Playgroud)
在Form1中,我有这两个构造函数
// of …Run Code Online (Sandbox Code Playgroud) 这是我在这里问到的另一个问题的后续问题:最后 从同一个类中的其他构造函数调用构造函数
前一个是关于如何,现在问题是为什么微软这样设计它?
更新:我的问题是:
为什么我不能直接在另一个构造函数的结尾处调用构造函数,而我可以在开始时调用它.
如果他们最后禁止打电话他们为什么不禁止在开头直接打电话呢?
代替
if (somecondition == 1)
{
int result = new myDelegate(MyClass.myMethod1);
}
else
{
int result = new myDelegate(MyClass.myMethod2);
}
Run Code Online (Sandbox Code Playgroud)
有可能做这样的事情
int result = new myDelegate("MyClass.myMethod" + i.ToString()); }
Run Code Online (Sandbox Code Playgroud)