求用《VB.NET》获取文件夹下的所有MP3文件名的代码 。Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For Each FileName As String In IO.Directory.GetFiles("E:\音乐", "*.mp3")
TextBox1.Text = vbNewLineIO.Path.GetFileName(FileName)
Next
End Sub
求vb.net的源代码 , 最好说明其解决问题,越多越好 , 满意加50分 。下面这段代码,是我用来计算每个月存500元进银行,连续30年,最后连本带利能有多少钱 。这里面涉及复利计算 。界面中右边的文本框用来输出每一次计算的结果 。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nianxian As Integer '年限变量
Dim dingcun As Integer '定存变量
Dim fuli_big As Long '大复利
Dim fuli_small As Long '小复利
【vb.net录音源代码 开源录音】Dim i As Integer '循环变量
Dim DATAstring As String '数据字符串
nianxian = Val(年限_TextBox.Text)
dingcun = Val(定存_TextBox.Text)
DATAstring = ""
For i = 1 To nianxian
fuli_small = dingcun * (1 + 0.1875)
dingcun = fuli_small
fuli_big = fuli_big + fuli_small
DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_big) + Chr(13) + Chr(10)
'DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_small) + Chr(13) + Chr(10)
Next
'fuli_big = fuli_small
TextBox1.Text = DATAstring
结果_TextBox.Text = Str(fuli_big) + "元"
End Sub
vb.net怎么编程实现从音频输出口输出指定频率指定时长和占空比的单音信号 。1.用Win32 API PlaySound
PlaySound位于"winmm.dll"中 , 可以根据输入参数的不同,播放WAV类型的音乐 。在VB.NET中调用跟VB6中差不多:
先声明:
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal lpszSoundName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
Const SND_FILENAME As Integer = H20000
Const SND_ALIAS As Integer = H10000
Const SND_SYNC As Integer = H0
具体还有很多常量,不一一列举,下面是播放一个wav文件的例子
Dim mstrfileName As String = "c:\eagle2.wav"
PlaySound(mstrfileName, 0, SND_FILENAME)
注意上面的播放是非同步的,就是说它并不会播放完毕才结束 。如果把上面的代码写在一个Button.Click的事件处理程序中,第二次点击的时候它会打断第一次的播放,重新开始 。
当然我们也可以调用系统的声音:
PlaySound("SystemStart", 0, SND_ALIAS Or SND_SYNC)
' 以同步的方式调用系统启动时候的声音 。
2. 调用媒体播放器控件
VB.NET中并没有提供媒体播放器的.NET组件,没办法我们还是调用以前Com组件Windows Media Player 。当然除了声音外,还可以播放视频文件 。
首先把媒体播放器控件加到工具栏中,调用还是简单的写一下吧:)
Private Sub playMediaFile(ByVal mediaFileName As String)
With MediaPlayer1
.Stop()
.FileName = "c:\mp3\爱不爱我.mp3"
.Play()
End With
End Sub
求助一个vb.net开发的闹铃源代码 , 要能自定义铃声的那种添加一个timer控件vb.net录音源代码,隔一秒(Interval = 1000)对照一次本地时间和指定vb.net录音源代码的时间,如果相同就执行铃声,并停止对照 。或者启动时取得本地时间,没一秒把这时间加1秒,直到加到指定vb.net录音源代码的时间执行铃声,并停止加 。播放mp3的代码 System.Runtime.InteropServices.DllImport("winmm.dll", _CharSet:=System.Runtime.InteropServices.CharSet.Auto) _Private Shared Function mciSendString(ByVal command As String, _ByVal buffer As System.Text.StringBuilder, _ByVal bufferSize As Integer, ByVal hwndCallback As IntPtr) As IntegerEnd FunctionPrivate aliasName As String = "MediaFile"'点击Button1(变成到指定时间就可以Private Sub Button1_Click(ByVal sender As Object, _ByVal e As EventArgs) Handles Button1.Click'要播放的文件比如在C:\music.mp3Dim fileName As String = "C:\music.mp3"Dim cmd As String'打开文件代码cmd = "open """ + fileName + """ type mpegvideo alias " + aliasNameIf mciSendString(cmd, Nothing, 0, IntPtr.Zero)0 ThenReturnEnd If '播放cmd = "play " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)End Sub'点击Button2停止播放(根据你自己的情况,比如建一个停止的按钮Private Sub Button2_Click(ByVal sender As Object, _ByVal e As System.EventArgs) Handles Button2.ClickDim cmd As String'播放中音乐停止cmd = "stop " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)'关闭cmd = "close " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)End Sub
推荐阅读
- jquery日期格式sss,jquery日期控件onchange事件
- 怎么在手机上用u盘,怎么在手机上用u盘下载
- excel的行列怎么调换,excel表格怎么将行和列调换
- jquery.snow.min.js的简单介绍
- python怎么自测函数 怎么检测python
- 奉化商城小程序开发,奉化商城小程序开发公司
- linux命令进f盘,linux命令进入u盘
- mysqloracle数据,mysql sql oracle
- mysql怎么建立链接 创建mysql数据库连接