我有一个可怕的问题。我构建了具有许多属性的怪异类,其中还有数组属性。
如果我想用CALLBYNAME来引用它们,那就不行了,让我们看一个例子:
P:\VisualStudio2015\Common7\IDE\
课程:.\
string cs = "Database=db; Data Source=localhost;User=root;Password=pass;";
MySqlConnection con = new MySqlConnection(cs);
con.Open();
string sql = "SELECT * FROM kunde";
MySqlCommand cmd = new MySqlCommand(sql, con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
MySqlCommandBuilder cb = new MySqlCommandBuilder(
try
{
DataRow nrad;
nrad = ds.Tables["kunde"].NewRow();
nrad["firmanavn"] = firmanavn.Text;
nrad["adresse"] = adresse.Text;
nrad["postadresse"] = postadresse.Text;
nrad["telefon"] = telefon.Text;
nrad["fax"] = fax.Text;
ds.Tables["kunde"].Rows.Add(nrad);
da.Update(ds, "kunde");
}
catch (Exception s)
{
Console.WriteLine(s.Message);
}
con.Close();
答案 0 :(得分:0)
您的Public Sub whatsoever()
Dim g As Long
Dim obj As Object
Set obj = New teszt
obj.init
For g = 0 To 4
CallByName obj, "GARG", VbLet, g, "g_" & CStr(g)
Next g
Debug.Print obj.GARG(0) '>> g_0
Debug.Print obj.GARG(1) '>> g_1
End Sub
属性接受索引和字符串:您无法传入整个数组
vehicle