問題
通常寫一個Library後,為了測試並說明使用方法,通常會希望再開一個專案,如果將這個專案建在其他目錄,管理上並不方便,另外,有時候我們希望兩個專案共用一些表單,須要複製一份,對Source Code Control也不是很方便,所以基於上訴原因,我會希望在同一個目錄建立兩個專案。
解決方案
通常新增一個專案後,VS會在指定目錄下建立一個與專案名稱同名的子目錄,透過這種方式,我們就無法在同一個目錄建立兩個專案,必須採取另一個變通的方式,在英文版的VS2010可以點選 File>New>Project from existing code ,選擇目錄及指定專案名稱後,就可以在既有的目錄新增一個專案,之後再把第一個專案加入到方案即可。
但是中文版VS2008卻看不到這個選單,經過一番搜尋,原來是被隱藏了。解決方法就是點選 工具>自訂,在 【命令】頁籤下找到【檔案】類別中的【現有程式碼中的專案】,將它拖曳到選單中,就搞定了。
Keep Coding !!
2010年11月4日 星期四
在同一個目錄建立兩個 .net 專案
2010年7月10日 星期六
2010年3月24日 星期三
Move Column position in Data Table
Q: How to Insert Data Column in a specified position, instead of appending to last column?
A: DataTable.Columns.Add does not support it. We need to adjust the position after adding the column. The sample code is listed as below:
Dim mColumn As New DataColumn("Column1")
Table1.Columns.Add(mColumn)
mColumn.SetOrdinal(0)
2010年1月21日 星期四
2009年9月16日 星期三
在Form_load事件中關閉表單
Q: 在Form_load事件中關閉表單,會造成程式錯誤,該如何解決?
A: 利用 Timer,在 Timer.Tick 事件中關閉表單,程式如下:
' close form since it cannot call me.close in form_load
Private WithEvents Timer1 As New Timer
Private Sub Timer1_Timer() Handles Timer1.Tick
Me.Close()
End Sub
Private Sub Form_Load(ByVal sender, ByVal e As System.EventArgs) Handles Me.Load
MsgBox(objTEJErrorMessage.GetLocalString("EA009_NoAccessRight").ToString)
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
2009年5月26日 星期二
Msg 3623, Level 16 error in SQL Server
今天執行一個 SQL 指令, 產生下列錯誤訊息:
Msg 3623, Level 16, State 1, Procedure sp0_anprcd_growth, Line 123發生網域錯誤。
查了老半天, 原來是數學運算有錯, 天啊. 這是哪一國的錯誤提示?
指令如下:
select a.證券代碼 , a.證券代碼 + ' ' + max(c.證券中文簡稱) as 證券 , POWER(CAST(10 AS FLOAT),SUM(LOG10(1+[報酬率%]))) as [股價漲跌%] , sum(case 日期 when a.EndDate then b.[收盤價(元)] end) as [迄日收盤價(元)] from #anprcd_1 a, view_anprcd b , view_astkind c where a.證券代碼=b.證券代碼 and a.證券代碼=c.證券代碼 and b.日期 >= a.StartDate and b.日期 <= a.EndDate group by a.證券代碼 order by [股價漲跌%] desc
應修正為
POWER(CAST(10 AS FLOAT),SUM(LOG10(1+[報酬率%]/100)))
感謝恩公如下:
http://www.sql-server-performance.com/faq/domain_error_occurred_p1.aspx
2008年12月31日 星期三
如何在.net程式中加密, Java程式中解密(Encode in .net and decode in java)
Q: 如何在.net程式中加密, Java程式中解密?
A:
.net:
Imports System.Web
...
Me.TextBox2.Text = HttpUtility.UrlEncode(Me.TextBox1.Text)
Java:
import java.net.*;
public class EncodeDecode{
public static void main(String[] args) {
System.out.println= URLDecoder.decode(args[0], "UTF-8");
}
}