Bi kaç Visual Basic kodu

MaXXSoFT

New member
Katılım
28 Haz 2005
Mesajlar
1,569
Reaction score
0
Puanları
0
Yaş
36
Konum
Ankara-Aydın
Kaçan buton!

command1 (height=600)

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i
if Command1.Top = 600 Then
For i = 600 To form1.Height - 2 * Command1.Height Step 3
Command1.Top = i
Next i

Else
For i = form1.Height - 2 * Command1.Height To 600 Step -3
Command1.Top = i
Next i

End if
End Sub
 
saat !

formunuza iki label , iki listbox ve bir timer ekleyin

Private Sub Form_Load()
List1.AddItem " "
List1.AddItem "On"
List1.AddItem "Yirmi"
List1.AddItem "Otuz"
List1.AddItem "Kırk"
List1.AddItem "Elli"

List2.AddItem ""
List2.AddItem "Bir"
List2.AddItem "İki"
List2.AddItem "Üç"
List2.AddItem "Dört"
List2.AddItem "Beş"
List2.AddItem "Altı"
List2.AddItem "Yedi"
List2.AddItem "Sekiz"
List2.AddItem "Dokuz"

Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim birler As Byte, onlar As Byte
Label1.Caption = Time
birler = Val(Mid(Label1.Caption, 8, 1))
onlar = Val(Mid(Label1.Caption, 7, 1))
List2.ListIndex = birler
List1.ListIndex = onlar
Label2.Caption = List1.Text + " " + List2.Text
End Sub
 
Start Bar ın Yok Edilmesi !

Yeni bir proje başlatın ve formun üzerine 2 adet buton koyun. Biri start barını gizlemek diğeride geri çağırmak için kullanılacak. Aşağıdaki kodu General declerations kısmından itibaren kopyalayın ve F5 ile çalıştırın.


Option Explicit

Dim hWnd1 As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40

Private Sub Command1_Click()
hWnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hWnd1, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub

Private Sub Command2_Click()
Call SetWindowPos(hWnd1, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub



Command1 butonuna bastığınızda start barı tamamı ile yok olacaktır. Bu aşamada çalışan programınızı kapatırsanız artık geri gelmez. Tekrar VB'den çalıştırın ve Command2'ye tıklayın artık start barınız eski yerine, aynı ihtişamıyla kurulacaktır. Kolay gelsin.
 
önce çok geniş bir form oluşturun
forma bir tane timer1yerleştirin
bir tane label1 yerleştirin
verdiğm kodu girin


Private Sub Form_Load()
Timer1.Interval = 10
AutoRedraw = True
Label1.AutoSize = True

End Sub

Private Sub Timer1_Timer()
Dim x, y
Static i
i = (i + 1) Mod 360
y = ScaleHeight / 2 + ScaleHeight / 2 * Sin(i * 3.1415 / 180)
x = ScaleWidth / 2 + ScaleWidth / 2 * Cos(i * 3.1415 / 180)
Label1.Top = y
Label1.Left = x
Line (ScaleWidth / 2, ScaleHeight / 2)-(x, y), i * 10
Label1 = i

End Sub
 
form üzerine eklenen combo buton üzerinde hareketlilik saglayabilirsiniz.

bu kodları denemek için form üzerini 1 combo buton ve 2 timer kontrolleri ilave edin



Private Sub Form_Load()
Timer1.Interval = 500
Timer2.Interval = 1000
Command1.Width = 1095
Command1.Height = 615
Command1.Top = 6600
Command1.Left = 8640
End Sub

Form.1’in load olayına yazılır
Timer.1’ in hareketlendirme süresi 500 salise olarak ayarlanır
Timer.2’ in hareketlendirme süresi 1 saniye olarak ayarlanır
Comman1 butonunun form üzerindeki enlem , boylam ve ebatları belirtilir.


Private Sub Timer1_Timer()
Command1.Width = 1105
Command1.Height = 625
Command1.Top = 6610
Command1.Left = 8650
End Sub
Timer.1’in timer özelliğine yazılmıştır.
Comman1 butonunun form üzerindeki enlem , boylam ve ebatları belirtilen ebatlarda büyültülmekte.



Private Sub Timer2_Timer()
Command1.Width = 1085
Command1.Height = 605
Command1.Left = 8630
Command1.Top = 6570
End Sub
Timer.2’nin timer özelliğine yazılmıştır.
Comman1 butonunun form üzerindeki enlem , boylam ve ebatları belirtilen ebatlarda küçültülmekte.
 
Visual basic te Yazıcının özelliklerini öğrenin!

Öncelikle bilgisayarınızda driverleri yüklü ve açık bir yazıcının bulunması gerekir aksi takdirde hata mesajıyla karşılaşırsınız..

Bir yazıcı yüklüyse ve yazıcı açıksa şu kodları girebilirsiniz

Private Sub Form_Load()
On Local Error GoTo hata
Show
Print "kağıt kaynağı"; Printer.PaperBin
Print "renk modu"; Printer.ColorMode
Print "kopya sayısı"; Printer.Copies
Print "Yazıcının ismi"; Printer.DeviceName
Print "sürücü"; Printer.DriverName
Print "çift yönlü yazma"; Printer.Duplex
Print "yataylık-dikeylik"; Printer.Orientation
Print "sayfa boyutu"; Printer.PaperSize
Print "kullanılan port"; Printer.Port
Print "basım kalitesi"; Printer.PrintQuality
Print "yazıcı varsayılan mı"; Printer.TrackDefault
Print "ölçekleme"; Printer.Zoom
hata:
MsgBox ("yüklü bir yazıcı yok veya yazınız açık değil")
End Sub
 
Bir sayıyı 10 luk tabandan başka bi tabana çevirecek program!

bir sayıyı 10'luk tabandan başka tabanlara dönüştürmek için şu kodu girmeniz yeter:

Private Sub Form_Load()
Dim s, x, b, n
x = Val(InputBox("çevrilecek sayıyı giriniz"))
n = Val(InputBox("tabanı giriniz"))
While x >= n
b = x Mod n
If b > 9 Then b = Chr(55 + b)
x = x \ n
s = x & s
Wend
If x > 9 Then x = Chr(55 + x)
s = x & s
MsgBox s
End Sub
 
MP3 Dosyalarının ID3 Tag'larını okuyun

Private Type mp3Tag
Tag As String * 3
Title As String * 30
Album As String * 30
Artist As String * 30
Year As String * 4
Comment As String * 30
Genre As String * 1
End Type

Private Sub Form_Load()
On Error Resume Next
Dim FileName As String
Dim CrTag As mp3Tag
'mp3 dosya adý !
FileName = "E:\mp3\BobDylan\Desire\Hurricane.mp3"
'mp3 dosyasýný veri okumak için aç !
Open FileName For Binary As #1
With CrTag
'ID3 Tag verisi dosyanýn son 128 baytlýk bölümünde bulunur !
Get #1, FileLen(FileName) - 127, .Tag
'Eðer dosya ID3 Tag verisini içeriyorsa verinin baþlangýcý TAG dýr !
'Aksi halde ID3 Tag verisini içermiyordur !
If .Tag <> "TAG" Then
Close #1
Exit Sub
End If
'ID3 Tag - Þarký Adý !
Get #1, , .Title
'ID3 Tag - Artist Adý !
Get #1, , .Artist
'ID3 Tag - Albüm Adý !
Get #1, , .Album
'ID3 Tag - Yýl !
Get #1, , .Year
'ID3 Tag - Açýklama !
Get #1, , .Comment
'ID3 Tag - Tür !
'Geri dönen deðer tek baytdýr ve her baytýn farklý anlamý vardýr !
'Örneðin 17 = Rock , 78 = Rock'n Roll !
Get #1, , .Genre
Close #1
lstMain.AddItem "Song : " & .Title, 0
lstMain.AddItem "Album : " & .Album, 1
lstMain.AddItem "Artist : " & .Artist, 2
lstMain.AddItem "Year : " & .Year, 3
lstMain.AddItem "Comment : " & .Comment, 4
lstMain.AddItem "Genre : " & CStr(Asc(.Genre)), 5
End With
End Sub
 
öss puan hesaplama. :mad:

Dim isim As String
Private Sub Command1_Click()
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
d = Val(Text4)
e = Val(Text5)
Select Case a
Case 1: a1 = 2.044
Case 2: a1 = 4.088
Case 3: a1 = 6.132
Case 4: a1 = 8.176
Case 5: a1 = 10.22
Case 6: a1 = 12.264
Case 7: a1 = 14.308
Case 8: a1 = 16.352
Case 9: a1 = 18.396
Case 10: a1 = 20.44
Case 11: a1 = 22.484
Case 12: a1 = 24.528
Case 13: a1 = 26.572
Case 14: a1 = 28.616
Case 15: a1 = 30.66
Case 16: a1 = 32.704
Case 17: a1 = 34.748
Case 18: a1 = 36.792
Case 19: a1 = 38.836
Case 20: a1 = 40.88
Case 21: a1 = 42.924
Case 22: a1 = 44.968
Case 23: a1 = 47.012
Case 24: a1 = 49.056
Case 25: a1 = 51.1
Case 26: a1 = 53.144
Case 27: a1 = 55.188
Case 28: a1 = 57.232
Case 29: a1 = 59.276
Case 30: a1 = 61.32
Case 31: a1 = 63.364
Case 32: a1 = 65.408
Case 33: a1 = 67.452
Case 34: a1 = 69.496
Case 35: a1 = 71.54
Case 36: a1 = 73.584
Case 37: a1 = 75.628
Case 38: a1 = 77.672
Case 39: a1 = 79.716
Case 40: a1 = 81.76
Case 41: a1 = 83.804
Case 42: a1 = 85.848
Case 43: a1 = 87.862
Case 44: a1 = 89.936
Case 45: a1 = 91.98
End Select
Select Case b
Case 1: b1 = 1.252
Case 2: b1 = 2.504
Case 3: b1 = 3.756
Case 4: b1 = 5.008
Case 5: b1 = 6.26
Case 6: b1 = 7.512
Case 7: b1 = 8.764
Case 8: b1 = 10.016
Case 9: b1 = 11.268
Case 10: b1 = 12.52
Case 11: b1 = 13.772
Case 12: b1 = 15.024
Case 13: b1 = 16.276
Case 14: b1 = 17.528
Case 15: b1 = 18.78
Case 16: b1 = 20.032
Case 17: b1 = 21.284
Case 18: b1 = 22.536
Case 19: b1 = 23.788
Case 20: b1 = 25.04
Case 21: b1 = 26.292
Case 22: b1 = 27.544
Case 23: b1 = 28.796
Case 24: b1 = 30.048
Case 25: b1 = 31.3
Case 26: b1 = 32.552
Case 27: b1 = 33.804
Case 28: b1 = 35.056
Case 29: b1 = 36.308
Case 30: b1 = 37.56
Case 31: b1 = 38.812
Case 32: b1 = 40.064
Case 33: b1 = 41.316
Case 34: b1 = 42.568
Case 35: b1 = 43.82
Case 36: b1 = 45.072
Case 37: b1 = 46.324
Case 38: b1 = 47.576
Case 39: b1 = 48.828
Case 40: b1 = 50.08
Case 41: b1 = 51.332
Case 42: b1 = 52.584
Case 43: b1 = 53.836
Case 44: b1 = 55.088
Case 45: b1 = 56.34
End Select
Select Case c
Case 1: c1 = 0.508
Case 2: c1 = 1.016
Case 3: c1 = 1.524
Case 4: c1 = 2.032
Case 5: c1 = 2.54
Case 6: c1 = 3.048
Case 7: c1 = 3.556
Case 8: c1 = 4.064
Case 9: c1 = 4.572
Case 10: c1 = 5.08
Case 11: c1 = 5.588
Case 12: c1 = 6.096
Case 13: c1 = 6.604
Case 14: c1 = 7.112
Case 15: c1 = 7.62
Case 16: c1 = 8.128
Case 17: c1 = 8.636
Case 18: c1 = 9.144
Case 19: c1 = 9.652
Case 20: c1 = 10.16
Case 21: c1 = 10.668
Case 22: c1 = 11.176
Case 23: c1 = 11.684
Case 24: c1 = 12.192
Case 25: c1 = 12.7
Case 26: c1 = 13.208
Case 27: c1 = 13.716
Case 28: c1 = 14.224
Case 29: c1 = 14.732
Case 30: c1 = 15.24
Case 31: c1 = 15.748
Case 32: c1 = 16.256
Case 33: c1 = 16.764
Case 34: c1 = 17.272
Case 35: c1 = 17.78
Case 36: c1 = 18.288
Case 37: c1 = 18.796
Case 38: c1 = 19.304
Case 39: c1 = 19.812
Case 40: c1 = 20.32
Case 41: c1 = 20.828
Case 42: c1 = 21.336
Case 43: c1 = 21.844
Case 44: c1 = 22.352
Case 45: c1 = 22.86
End Select
Select Case d
Case 1: d1 = 0.208
Case 2: d1 = 0.416
Case 3: d1 = 0.624
Case 4: d1 = 0.832
Case 5: d1 = 1.04
Case 6: d1 = 1.248
Case 7: d1 = 1.456
Case 8: d1 = 1.664
Case 9: d1 = 1.872
Case 10: d1 = 2.08
Case 11: d1 = 2.288
Case 12: d1 = 2.496
Case 13: d1 = 2.704
Case 14: d1 = 2.912
Case 15: d1 = 3.12
Case 16: d1 = 3.328
Case 17: d1 = 3.536
Case 18: d1 = 3.744
Case 19: d1 = 3.952
Case 20: d1 = 4.16
Case 21: d1 = 4.368
Case 22: d1 = 4.576
Case 23: d1 = 4.784
Case 24: d1 = 4.992
Case 25: d1 = 5.2
Case 26: d1 = 5.408
Case 27: d1 = 5.616
Case 28: d1 = 5.824
Case 29: d1 = 6.032
Case 30: d1 = 6.24
Case 31: d1 = 6.448
Case 32: d1 = 6.656
Case 33: d1 = 6.864
Case 34: d1 = 7.072
Case 35: d1 = 7.28
Case 36: d1 = 7.488
Case 37: d1 = 7.696
Case 38: d1 = 7.904
Case 39: d1 = 8.112
Case 40: d1 = 8.32
Case 41: d1 = 8.528
Case 42: d1 = 8.736
Case 43: d1 = 8.944
Case 44: d1 = 9.152
Case 45: d1 = 9.36
End Select
MsgBox isim & " ÖSS Sözel Puanın: " & (a1 + b1 + c1 + d1 + 119.425)
MsgBox "Öss Sözel Puan(Eklemeli): " & (a1 + b1 + c1 + d1 + 119.425 + e)
End Sub
Private Sub Command2_Click()
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
d = Val(Text4)
e = Val(Text5)
st = a * 1.505
ss = b * 0.543
sm = c * 1.714
sf = d * 0.21
MsgBox isim & " Öss Eşit Ağırlık Puanın: " & (st + ss + sm + sf + 121.215)
MsgBox "Öss Eşit Ağırlık Puanı(Eklemeli): " & (st + ss + sm + sf + 121.215 + e)
End Sub

Private Sub Command3_Click()
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
d = Val(Text4)
e = Val(Text5)
st = a * 0.537
ss = b * 0.172
sm = c * 1.796
sf = d * 1.404
MsgBox isim & " Öss Sayısal Puanın: " & (st + ss + sm + sf + 124.001)
MsgBox "Öss Sayısal Puan(Eklemeli): " & (st + ss + sm + sf + 124.001 + e)
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Command5_Click()
MsgBox "Sözel:119.425 T.M:121.215 Sayısal:124.001"
End Sub
Private Sub Command6_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
End Sub

Private Sub Form_Load()
isim = InputBox("İsminizi giriniz")
End Sub
 
güzel güzel , hepsi arşivlik bunların ;)
 
kodlar için sağol arkadaşım
 
yukarıdakı saat örnegı cok hosuma gıttı.hocamızda bıze bı ödew werdı işte bı program yazıp anlatın dıee ben anladım ama wordde anlatmam gerekıo smdı bana bırı yardımcı oLabıLırmı Lutfenn..
 
teşekkürler
 
Geri
Üst