佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

楼主: chrizyuen2

[挑战自我] 欢迎任何C#疑难杂症(编写完整软件除外)

  [复制链接]
 楼主| 发表于 19-4-2012 09:20 AM | 显示全部楼层
大大有个问题想请教你,
Add New Client
我按这个link 他会pop一个javascript的东西出来..可是这个是在fro ...
tmxiaochao 发表于 17-4-2012 11:34 AM


给我看你的javascript, 我才能知道发生什么事情。
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 19-4-2012 09:48 AM | 显示全部楼层
我bind到了我要bind的property了。。谢谢。。
twigky 发表于 8-4-2012 07:44 PM


expandoObject in C# 4.0
  1.         public Form1()
  2.         {
  3.             InitializeComponent();
  4.             dynamic x = new ExpandoObject();
  5.             x.Person = "abc";
  6.             x.Address = "Jalan Besar";
  7.             MessageBox.Show(x.Address);
  8.             textBox1.DataBindings.Add("Text", x, "Address");
  9.         }
复制代码

textBox1.DataBindings.Add("Text", x, "Address");  <---这个不能成功,因为dynamic 不能当data binding.
回复

使用道具 举报

发表于 19-4-2012 10:23 AM | 显示全部楼层
expandoObject in C# 4.0

textBox1.DataBindings.Add("Text", x, "Address");
chrizyuen2 发表于 19-4-2012 09:48 AM


我做了多一个步骤。不过可以做到了binding。

  1.    public struct PropValue
  2.    {
  3.       public Object Value { get; set; }
  4.    }

  5.    class Class1
  6.    {
  7.       private Dictionary<string,PropValue> _props = new Dictionary<string,PropValue>();

  8.       public PropValue this[string Name]
  9.       {
  10.          get
  11.          {
  12.             return _props[Name];
  13.          }
  14.          set
  15.          {
  16.             ....
  17.          }
  18.       }
  19.    }
  20.       //Binding part
  21.       txtAddress.DataBindings.Add("Text", _contact["Address"], "Value");
复制代码
   

我看了你的expandoObject code之后。。。
真的觉得。。受益不浅!
谢谢!
回复

使用道具 举报

 楼主| 发表于 19-4-2012 10:29 AM | 显示全部楼层
回复 163# twigky
谢谢你,我也学到你的method了。
回复

使用道具 举报

发表于 19-4-2012 10:34 AM | 显示全部楼层
回复  twigky
谢谢你,我也学到你的method了。
chrizyuen2 发表于 19-4-2012 10:29 AM


大家交流交流。。。
C#。。我只是beginner。
回复

使用道具 举报

发表于 9-5-2012 12:11 PM | 显示全部楼层
chrizyuen2 我需要你的幫助 我的project出了問題,add我skype 我必須要今日完成一個任務
skype :kimson101
回复

使用道具 举报

Follow Us
 楼主| 发表于 9-5-2012 01:22 PM | 显示全部楼层
回复 166# kimson101

麻烦你post在这里。
回复

使用道具 举报

发表于 10-5-2012 10:50 AM | 显示全部楼层
什么是foreach?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 10-5-2012 05:19 PM | 显示全部楼层
本帖最后由 chrizyuen2 于 10-5-2012 05:20 PM 编辑
什么是foreach?
weitao 发表于 10-5-2012 10:50 AM


要明白foreach. 需要学一样东西,IEnumerable, yield return.
每次你回传(yield return)一个数据,你的while会等待下一个次foreach 的进入。

  1. using System;
  2. using System.Collections.Generic;

  3. public class Program
  4. {
  5.     static void Main()
  6.     {
  7.         //
  8.         // Compute two with the exponent of 30.
  9.         //
  10.         foreach (int value in ComputePower(2, 30))
  11.         {
  12.             Console.Write(value);
  13.             Console.Write(" ");
  14.         }
  15.         Console.WriteLine();
  16.     }

  17.     public static IEnumerable<int> ComputePower(int number, int exponent)
  18.     {
  19.         int exponentNum = 0;
  20.         int numberResult = 1;
  21.         //
  22.         // Continue loop until the exponent count is reached.
  23.         //
  24.         while (exponentNum < exponent)
  25.         {
  26.             //
  27.             // Multiply the result.
  28.             //
  29.             numberResult *= number;
  30.             exponentNum++;
  31.             //
  32.             // Return the result with yield.
  33.             //
  34.             yield return numberResult;
  35.         }
  36.     }
  37. }
  38. //Output:
  39. //2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824
复制代码
回复

使用道具 举报

发表于 21-5-2012 09:46 AM | 显示全部楼层
大大,..我想做一个类似去cc店然后按他的game menu pop出来的window form里面排起来的game icon..请问在.net应该用什么control??
回复

使用道具 举报

 楼主| 发表于 21-5-2012 01:12 PM | 显示全部楼层
大大,..我想做一个类似去cc店然后按他的game menu pop出来的window form里面排起来的game icon..请问在.net应该用什么control??tmxiaochao 发表于 21-5-2012 09:46 AM


listview control
回复

使用道具 举报

发表于 21-5-2012 06:10 PM | 显示全部楼层
可是listview 的是和我们平时开folder然后里面的view是medium icons那种一样吗?我不是要类似details view的
回复

使用道具 举报

 楼主| 发表于 21-5-2012 09:37 PM | 显示全部楼层
可是listview 的是和我们平时开folder然后里面的view是medium icons那种一样吗?我不是要类似details view的 ...
tmxiaochao 发表于 21-5-2012 06:10 PM


你有example么,要做成怎样!?
回复

使用道具 举报

发表于 21-5-2012 10:47 PM | 显示全部楼层
tab + listview
?
回复

使用道具 举报

发表于 22-5-2012 04:38 PM | 显示全部楼层
本帖最后由 tmxiaochao 于 22-5-2012 04:39 PM 编辑

大大我要做一个类似将的东西..
http://forums.pcworld.com/index.php?/topic/67386-ubuntu-910-the-good-the-bad-and-the-unknown/那个folder icon..我的东西都是从db里面拉出来的..
回复

使用道具 举报

 楼主| 发表于 22-5-2012 05:02 PM | 显示全部楼层
大大我要做一个类似将的东西..
http://forums.pcworld.com/index.php?/topic/67386-ubuntu-910-the-good-t ...
tmxiaochao 发表于 22-5-2012 04:38 PM


没错拉,是用C#的listview.快去try try, 有什么不懂再来问。
回复

使用道具 举报


ADVERTISEMENT

发表于 22-5-2012 10:21 PM | 显示全部楼层
回复 176# chrizyuen2


   可是我那个做到的不是detail list的吗?
回复

使用道具 举报

 楼主| 发表于 23-5-2012 11:23 AM | 显示全部楼层
回复  chrizyuen2
可是我那个做到的不是detail list的吗?
tmxiaochao 发表于 22-5-2012 10:21 PM


如此这般
http://msdn.microsoft.com/en-us/library/s8z85th0.aspx
回复

使用道具 举报

发表于 25-5-2012 12:42 PM | 显示全部楼层
谢谢大大, 弄到了. 另外有个问题想问大大.
请问一个method一定要加virtual才可以被ovveride吗? 没有virtual就不能被ovveride了?
sealed 和 abstract怎么用?
回复

使用道具 举报

 楼主| 发表于 25-5-2012 01:00 PM | 显示全部楼层
谢谢大大, 弄到了. 另外有个问题想问大大.
请问一个method一定要加virtual才可以被ovveride吗? 没有virtual就不能被ovveride了?
sealed 和 abstract怎么用?tmxiaochao 发表于 25-5-2012 12:42 PM


method一定要加virtual才可以被override吗 yes


seal 起来,后代就不能override 了。
abstract 有点像 C++ 的prototype. 你只是申明有着function, 但是内容必须由孩子们编写。
http://msdn.microsoft.com/en-us/library/sf985hc5(v=vs.71).aspx
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 14-10-2025 08:32 AM , Processed in 0.113363 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表