|
Why, oh why, are they teaching VB.net in schools ?
We're happy to help, but not to do your homework. First, you try. That's the point of the exercise. The world does not need this program, but you need to try and write it in order to solidify what you should have learned in class.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No problem I'll post what I have so far. I am having a problem getting the fuction to work properly.
Thanks for the encouragement. I only need help not the solution.
Thanks again
|
|
|
|
|
This is what I ahve so far.
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim h As Double 'h is height
Dim v As Double 'v is velocity
Dim t As Double 't is time
Dim ballHt As Double
h = CDbl(txtIniHeight.Text)
v = CDbl(txtIniVelocity.Text)
t = 0
CalcBallHt(h, v, t, ballHt)
lstResults.Items.Clear()
lstResults.Items.Add(ballHt)
End Sub
Function CalcBallHt(ByRef h As Double, ByRef v As Double, _
ByRef t As Double, ByRef ballHt As Double) As Double
ballHt = h + v * t - 16 * t * t
Return ballHt
End Function
I am having a problem getting the function to work
I am sure it has something to do with the variable time but i'm not sure how to resolve this.
Please Help
Thanks
|
|
|
|
|
hello
Now WHat u want Exactly Your Programe work Properly as per ur requiste
for example
If u give h=2 and v= 2 then it will return 2
How BallHt= 2+2*0-16*0*0 remains 2*0-0 remains 2
it will execute in BODMAS order
I dont know waht result exactly u want,if u get wrong result change ur formula with brackets the first part u want to execute
Ishak
|
|
|
|
|
how to connect crystal reporet in vb
vikash ranjan
|
|
|
|
|
Hey guys/gals,
Im getting a return error of 11 when i try to run this
code:
Region " waveInOpen "<br />
'opens input for recording<br />
<DllImport("winmm.dll", EntryPoint:="waveInOpen", _<br />
CallingConvention:=CallingConvention.StdCall)> _<br />
Public Shared Function waveInOpen(ByRef lphWaveIn As IntPtr, ByVal uDeviceID As Integer, _<br />
ByRef lpFormat As WAVEFORMAT, ByVal dwCallback As Integer, ByVal dwInstance As Integer, _<br />
ByVal dwFlags As Integer) As Integer<br />
<br />
End Function<br />
<br />
'used to describe format of wave data<br />
<br />
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _<br />
Structure WAVEFORMAT<br />
Friend wFormat As Integer<br />
Friend nChannels As Integer<br />
Friend nSamplesPerSec As Integer<br />
Friend nAvgBytesPerSec As Integer<br />
Friend nBlockAlign As Integer<br />
End Structure<br />
<br />
Private Const WAVE_MAPPER As Integer = -1&<br />
Private Const WAVE_FORMAT_DIRECT As Integer = &H8<br />
Private Const CALLBACK_NULL As Integer = &H0<br />
Private Const WAVE_FORMAT_PCM As Integer = 1<br />
Private structWaveInputVars As WAVEFORMAT<br />
<br />
<br />
#End Region<br />
<br />
Here's how im calling wave open. please note there are no calbacks
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim l As Long<br />
l = waveInGetDevCaps(0, structWave, Marshal.SizeOf(structWave))<br />
With structWaveInputVars<br />
.wFormat = WAVE_FORMAT_PCM<br />
.nChannels = 2<br />
.nSamplesPerSec = 11025<br />
.nAvgBytesPerSec = .nSamplesPerSec * .nBlockAlign<br />
.nBlockAlign = 4<br />
<br />
End With<br />
Dim hDevice As IntPtr<br />
<br />
<br />
l = waveInOpen(hDevice, 0, structWaveInputVars, 0, 0, CALLBACK_NULL)<br />
Please ignore the waveingetdecaps. that works for me.
I used to be great with win apis in vb6....now not so greay in vb.net
Any help would be greatly appreciated
I got it....NOPE
|
|
|
|
|
<structlayout (layoutkind.sequential)=""> _
Structure WAVEFORMAT
Public wFormat As Short
Public nChannels As Short
Public nSamplesPerSec As Integer
Public nAvgBytesPerSec As Integer
Public nBlockAlign As Short
End Structure
|
|
|
|
|
<StructLayout (LayoutKind.Sequential)> _
Structure WAVEFORMAT
Public wFormat As Short
Public nChannels As Short
Public nSamplesPerSec As Integer
Public nAvgBytesPerSec As Integer
Public nBlockAlign As Short
End Structure
ERROR_BAD_FORMAT (11) An attempt was made to load a program with an incorrect format.
|
|
|
|
|
Ok now i am getting error 32. whats that one??
I have declared structure variables as public and
changed the data points to short...the ones that you have changed.
Thanks a lot for your help so far
I got it....NOPE
|
|
|
|
|
ERROR_SHARING_VIOLATION (32)
32 The process is being used by another process.
show me your new code
|
|
|
|
|
heres the code now:
<br />
#Region " waveInOpen "<br />
'opens input for recording<br />
'had to take entry tag out please note<br />
DllImport("winmm.dll", EntryPoint:="waveInOpen", _<br />
CallingConvention:=CallingConvention.StdCall)> _<br />
Public Shared Function waveInOpen(ByRef lphWaveIn As IntPtr, ByVal uDeviceID As Integer, _<br />
ByRef lpFormat As WAVEFORMAT, ByVal dwCallback As Integer, ByVal dwInstance As Integer, _<br />
ByVal dwFlags As Integer) As Integer<br />
<br />
End Function<br />
<br />
'used to describe format of wave data<br />
<br />
<StructLayout(LayoutKind.Sequential)> _<br />
Structure WAVEFORMAT<br />
Public wFormat As Short<br />
Public nChannels As Short<br />
Public nSamplesPerSec As Integer<br />
Public nAvgBytesPerSec As Integer<br />
Public nBlockAlign As Short<br />
End Structure<br />
<br />
Private Const WAVE_MAPPER As Integer = -1&<br />
Private Const WAVE_FORMAT_DIRECT As Integer = &H8<br />
Private Const CALLBACK_NULL As Integer = &H0<br />
Private Const WAVE_FORMAT_PCM As Integer = 1<br />
Private structWaveInputVars As WAVEFORMAT<br />
Heres where the function is called:
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim l As Long<br />
l = waveInGetDevCaps(0, structWave, Marshal.SizeOf(structWave))<br />
With structWaveInputVars<br />
.wFormat = WAVE_FORMAT_PCM<br />
.nChannels = 2<br />
.nSamplesPerSec = 11025<br />
.nAvgBytesPerSec = .nSamplesPerSec * .nBlockAlign<br />
.nBlockAlign = 4<br />
<br />
End With<br />
Dim hDevice As IntPtr<br />
<br />
<br />
l = waveInOpen(hDevice, 0, structWaveInputVars, 0, 0, CALLBACK_NULL)<br />
<br />
End Sub<br />
<br />
I got it....NOPE
|
|
|
|
|
I went back to check the structure and I find there is more to the structure.
<structlayout (layoutkind.sequential)=""> _
Structure WAVEFORMAT
Public wFormatTag As Short
Public nChannels As Short
Public nSamplesPerSec As Integer
Public nAvgBytesPerSec As Integer
Public nBlockAlign As Short
Public wBitsPerSample As Integer
Public cbSize As Integer
End Structure
Let me dig through some of my past source, because I came across this problem before and I know I found a fix for this problem.
|
|
|
|
|
Right that is for the WAVEFORMATEX structure.
I dont believe this is necessary to use, however, it is more descriptive. I just wanted to use the minimum number of variables to limit trouble shooting
I got it....NOPE
|
|
|
|
|
this is from ms's site for retrieving the device handle:
phwi
Pointer to a buffer that receives a handle identifying the open waveform-audio input device. Use this handle to identify the device when calling other waveform-audio input functions. This parameter can be NULL if WAVE_FORMAT_QUERY is specified for fdwOpen.
How do you create a buffer for a pointer?? inptr
I dont want the parameter to be null since i will be using this handle in the future to actually play a sound god forbid. So, I will not use the flag mentioned above
I got it....NOPE
|
|
|
|
|
Dim hDevice As new IntPtr.zero
sorry, still looking for my old vb.net mixer stuff.
|
|
|
|
|
ebred,
Sorry I havn't located what I was working on, I'll go back thru some back-up's I made tomarrow, I do remember it having something to do with allocating memory for the buffer. I'll send you an email when I locate my notes or source.
If anyone else can help, please do.
|
|
|
|
|
Phew.
I got it to work. I submitted a question on a ms run community. I was calcualting average bytes with variables that had not yet been calculated in the waveformat structure i posted earlier.
I have converted to WAVEFORMATEX as well.
Here the code that will return a handle to the device:
<br />
'opens input for recording<br />
<DllImport("winmm.dll", EntryPoint:="waveInOpen", _<br />
CallingConvention:=CallingConvention.StdCall)> _<br />
Public Shared Function waveInOpen(<Out()> ByRef lphWaveIn As IntPtr, ByVal uDeviceID As Integer, _<br />
ByRef lpFormat As WAVEFORMATEX, ByVal dwCallback As Integer, ByVal dwInstance As Integer, _<br />
ByVal dwFlags As Integer) As Integer<br />
<br />
End Function<br />
<br />
'used to describe format of wave data<br />
<br />
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _<br />
Structure WAVEFORMATEX<br />
Public wFormat As Short<br />
Public nChannels As Short<br />
Public nSamplesPerSec As Integer<br />
Public nAvgBytesPerSec As Integer<br />
Public nBlockAlign As Short<br />
Public wBitsPerSample As Short<br />
Public cbSize As Short<br />
<br />
End Structure<br />
<br />
Private Const WAVE_FORMAT_QUERY As Long = &H1<br />
Private Const WAVE_MAPPER As Integer = -1&<br />
Private Const WAVE_FORMAT_DIRECT As Integer = &H8<br />
Private Const CALLBACK_NULL As Integer = &H0<br />
Private Const WAVE_FORMAT_PCM As Integer = 1<br />
Private structWaveInputVars As WAVEFORMATEX<br />
<br />
<br />
#End Region<br />
Heres the calling code:
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim l As Long<br />
With structWaveInputVars<br />
.wFormat = WAVE_FORMAT_PCM<br />
.nChannels = 2<br />
.nSamplesPerSec = 11025<br />
.nAvgBytesPerSec = 176400 'no longer calculated<br />
.nBlockAlign = 4<br />
.wBitsPerSample = 8<br />
.cbSize = 0<br />
End With<br />
<br />
hDevice = Marshal.AllocHGlobal(4)<br />
<br />
<br />
<br />
l = waveInOpen(hDevice, 0, structWaveInputVars, 0, 0, CALLBACK_NULL)<br />
<br />
End Sub<br />
Thanks a lot for your help anon
|
|
|
|
|
Hey, your welcome, I see you got it...
P.S. don't forget:
Marshal.FreeHGlobal(hDevice)
when your done with it.
|
|
|
|
|
Hello,
I am trying to bind a specific column to a specific control. The problem is that when the combo box control appears blank when I try to bind a column to this control, but if I bind the column to a text box, then it displays the correct value of that column.
pbndtemp = New Binding("Text", ds, "schedule_detail.Expr1")
Me.cboTrainingProgress.DataBindings.Add(pbndtemp)
pbndtemp = New Binding("Text", ds, "schedule_detail.Expr1")
Me.txtProgress.DataBindings.Add(pbndtemp)
Do I need to evaluate or validate the combo box binding? If so, how do I do that?
Thanks,
Jay
Feng Screwed... the art of moving to a new place because the old place is just too messy and not worth the effort to clean.
|
|
|
|
|
Private Sub box_Keypress(KeyAscii As Integer)
'if you enter ALT+0176
'then KeyAscii = 176 normaly, but on some WinXP machines
'KeyAscii = -23583 (because character not in range [0,127]).
'Also note that if you try to convert this value to a character,
'you'll get a range error (of course).
End Sub
Does anyone know why we receive an invalid character code on some WinXP machines and not on others?
Why are only characters in the range [0,127] being properly passed to Keypress?
Signed: John R. Shaw
|
|
|
|
|
|
Note: UNICODE uses same extended character codes as windows extended codes.
The problem only happens in VB code.
I think the problem only occurs on WinXP, if more than one language is installed.
On Win2000; if you select Chinese (Taiwan):
ALT+0176 translated to 162 = '¢'.
ALT+0177 translated to 161 = 'í'.
ALT+0178 translated to 50 = '2'.
|
|
|
|
|
Well if u say that MSN messenger is a service then how was it made when .NET was not introduced.How did the developers made it a service without .NET platform.
|
|
|
|
|
Services pre-date .Net by years. Look at the article here: http://www.vbrad.com/pf.asp?p=source/tip_service_vb.htm
It should have the answers your looking for.
Joe.
|
|
|
|
|
Ever here of Visual C++? It can generate ANY type of application for Windows. Including Windows itself! Think about it -- How long has Windows been around? Services, as we know them today, have been around since Windows NT 3.1, LONG before the .NET Framework came around...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|