關於vb的程式設計

時間 2022-07-09 10:20:09

1樓:

'用到mschart 控制元件,你這會吧

private sub graphshowbasic()

with mschart1.plot.backdrop

.fill.style = vtfillstylebrush

.fill.brush.fillcolor.set 100, 255, 200

.frame.style = vtframestylethickinner

.shadow.style = vtshadowstyledrop

end with

end sub

private sub form_activate()

dim arrdata(1 to 12, 1 to 2)

mschart1.showlegend = true

arrdata(1, 1) = "一月" '你要顯示的x軸資料

arrdata(2, 1) = "二月"

arrdata(3, 1) = "三月"

arrdata(4, 1) = "四月"

arrdata(5, 1) = "五月"

arrdata(6, 1) = "六月"

arrdata(7, 1) = "七月"

arrdata(8, 1) = "八月"

arrdata(9, 1) = "九月"

arrdata(10, 1) = "十月" '

arrdata(11, 1) = "十一月"

arrdata(12, 1) = "十二月"

arrdata(1, 2) = 200

mschart1.chartdata = arrdata

mschart1.plot.seriescollection(1).legendtext = "你要顯示的名字"

with mschart1

.rowcount = 12

.chartdata = arrdata

.column = 1

.refresh

end with

end sub

private sub command1_click()

'這裡寫上你自已連線execl的方式,可以把1樓的方式寫進來,1樓的方式是要引用ms office的

'將execl的什讀出來賦給 arrdata(1,1-2) 和arrdata(1-12,1)

'arrdata(1,2)= rs.recordcount 『

graphshowbasic

』下面的是連sql的方式

'dim myconstr as string '連資料庫字串

' dim sqlstr as string, sqlstr2 as string

' dim conn2 as new adodb.connection '連線物件

' myconstr = "provider=sqloledb.1;persist security info=false;" & _

' "user id=sa;password=123456;initial catalog=khgl;data source=" & 'serverip=192.168.2.

104 '語句1

' dim rs as new adodb.recordset

'conn2.open myconstr

'sqlstr = "select * from khgl where 來電時間》='2009-1-1' and 來電時間<='2009-1-31'"

'rs.open sqlstr, conn2, 1, 1

'arrdata(1,2)= rs.recordcount

'rs.close

end sub

2樓:匿名使用者

建議使用vb.net來程式設計,功能要比vb強很多。特別是對execl程式設計和支援上更為強大!

3樓:匿名使用者

你的問題到底是繪圖還是vb與excel的通訊,請說明清楚。

4樓:匿名使用者

你先說說看你是怎樣把資料儲存到excel得?

5樓:匿名使用者

把execl當資料庫 搞定它

有關vb程式設計的一個問題,急啊 關於VB程式設計的小問題

這需要使用資料庫來做分析。建立職工表 惟一號碼 姓名 職稱 工齡 然後對應職工實際資訊輸入進職工表中。然後執行sql語句。select 四室兩廳住房數 count from 職工表 where 職稱 副高階 and 工齡 20 select 四室一廳住房數 count from 職工表 where ...

VB程式設計題,VB程式設計練習題?

1.新建工程 工程1 2.新建一下combobox控制元件 combo1,並將屬性style改為2 3.新建五個label label1,label2,label3,label4,label5 4.新建兩個text文字框 text1,text2 5.新建一個commandbutton按鈕 comma...

VB程式設計

在用print輸出的時候在輸出後面加個 號就可以連在一起了,比如 print 123 要是想五個一行就用個迴圈 for i 1 to 5 print 你要輸出的東西 next i 這樣就會是5個一行了 給你段 僅做參考 private sub dim i j a 4 ran.這初始化單詞不會了,自己...