|
I'm trying to create an interesting opening to an encryption program that I'm writing. If anyone has seen The Matrix(Who hasn't?), I'm trying to recreate the effect of those screens that have those different characters scroll down the screen.
What I've done is created 21 labels on the top of my form. I create a random number from 1 to 255 so it will be used to change the individual labels.
For Example :
lblLabel1.text = Chr(RandomNumber)
right after this command, I move the label down by 8 pixels.
For Example:
lblLabel1.top = lblLabel1.top + 8
I have assigned 21 timers for 21 different labels. My question is: Is there anyway that I can use a For Next loop to scroll through each label on my form instead of making all those timers?
I tried making an array before, but I'm getting an error. I made the array as a public declaration
Example:
Public Label(20) as Label
Then, when I try to have the timer go through each one, it gives me a syntax error?
What should I do? What am I doing wrong?
Sorry so long!
Thanks for your time;P
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
<br />
Dim objLabel As Control<br />
For Each objLabel In Me.Controls<br />
If TypeOf objLabel Is Label Then<br />
MsgBox(objLabel.Name)<br />
'////do your code here for that label<br />
End If<br />
Next<br />
not sure if thats the sort of thing you are after?
you could then have 1 function to loop through each label rather than 20 odd sets of timers etc...
and you could use sleep function inplace of timers for that function
System.Threading.Thread.Sleep(20)'/// your time where it says 20.
switch(twinsOnWay).<br/> {<br/> case ("twins on the way"):<br/> MessageBox.Show("for mr and mrs dynamic","twins on the way");<br/> break;<br/>}
|
|
|
|
|
Thank You!
That was the kind of for next loop I was looking for. The only thing is, I have other labels on the form that do not need to be moved down (only label1 through label21). How can I only loop through labell through label21?
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
<br />
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click<br />
Dim objLabel As Control<br />
For Each objLabel In Me.Controls<br />
If TypeOf objLabel Is Label Then<br />
If objLabel.Name = "Label" > "0" < "21" Then<br />
MoveLabel(objLabel)<br />
End If<br />
End If<br />
Next<br />
End Sub<br />
<br />
Public Function MoveLabel(ByVal lbl As Label)<br />
Dim i As Integer<br />
Dim j As Integer = lbl.Top<br />
<br />
For i = 1 To 60<br />
j = j + +1<br />
lbl.Top = j<br />
System.Threading.Thread.Sleep(20)<br />
Next<br />
End Function<br />
that moves 20 label 1 at a time in a smooth scroll , you can change the time of scroll on the sleep section.
switch(twinsOnWay). { case ("twins on the way")://not
long now MessageBox.Show("for mr and mrs dynamic","twins on the way"); break; }
|
|
|
|
|
Hell Yeah!
Thanks a lot for your help!
I owe you one
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
np glad to have helped
<font color="blue">Private void</font> ExpectingTwins(<font color="blue">string</font> twins)
{
<font color="blue">switch</font>(twins)
{
<font color="blue">Case</font> ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
<font color="blue">break</font>;
}
}
|
|
|
|
|
Hi! I'm totally new in VB.net... I bought The VB.net Deluxe Learning Edition 2003 kit... I may not be done with it (almost though) but as I skimmed through the book I noticed that it does NOT show you how to play sounds and music... (I'm not usre if it even teaches you Avis!)
I was just wondering what object do i need to use to open and play sonds and music...
Or if there is no object... HOW DO YOU DO IT?!
BTW: I looked aeverywhere for the answer already...
Thnx
|
|
|
|
|
For sound, use the sndPlaySound() API. For video, use the Windows Media Player control or something similar.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
an old example in .net i did for someone a few months ago , might give you a helping hand with the sound
<font color="blue">Private</font> <font color="blue">Declare</font> <font color="blue">Function</font> sndPlaySound <font color="blue">Lib</font> "winmm.dll" <font color="blue">Alias</font> "sndPlaySoundA" _
(<font color="blue">ByVal</font> lpszSoundName <font color="blue">As String</font>, <font color="blue">ByVal</font> uFlags <font color="blue">As Integer</font>) <font color="blue">As Long</font>
<font color="blue">Const</font> SND_SYNC <font color="blue">As Integer</font> = &H0
<font color="blue">Const</font> SND_ASYNC <font color="blue">As Integer</font> = &H1
<font color="blue">Const</font> SND_NODEFAULT <font color="blue">As Integer</font> = &H2
<font color="blue">Const</font> SND_LOOP <font color="blue">As Integer</font> = &H8
<font color="blue">Const</font> SND_NOSTOP <font color="blue">As Integer</font> = &H10
<font color="blue">Dim</font> SoundName <font color="blue">As String</font>, wFlags <font color="blue">As Integer</font>, x <font color="blue">As String</font>
<font color="blue">Private</font> <font color="blue">Sub</font> Button1_Click(<font color="blue">ByVal</font> sender <font color="blue">As</font> System.Object, <font color="blue">ByVal</font> e <font color="blue">As</font> System.EventArgs) <font color="blue">Handles</font> Button1.Click
SoundName = "C:\Documents and Settings\Den\My Documents\Visual Studio Projects\WindowsApplication1\beav_rap.wav"
wFlags = SND_ASYNC <font color="blue">Or</font> SND_NODEFAULT
x = sndPlaySound(SoundName, wFlags)
<font color="blue">End</font> <font color="blue">Sub</font>
<font color="blue">Private void</font> ExpectingTwins(<font color="blue">string</font> twins)
{
<font color="blue">switch</font>(twins)
{
<font color="blue">Case</font> ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
<font color="blue">break</font>;
}
}
|
|
|
|
|
Okay, what if the whole folder, pgm and all, is read-only? Can you change it to grant write access through code? I'm trying to play with the fileIOpermissions but I think I'm going down the wrong track...
|
|
|
|
|
I have a datagrid that displays information based on searches. When I run a search, the datagrid fills and I can scroll through the table. However, let's say I scroll down the list a little, and then decide to run another search. The datagrid fills with the new information and shows the top of the list, but the scroll box doesn't change. Then when I click on the scroll bar the table snaps to where it would be in relation to the scroll bar.
How do I make the scroll bar move back to the top when the datagrid fills with new information? (This is on a Windows form btw)
Puzzled...
|
|
|
|
|
Take a look here http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q895q or maybe try setting the current cell like this:
Datarid.CurrentCell = New DataGridCell(0, 1)
|
|
|
|
|
thank you - looks like a good site, I'll be bookmarking that!
I actually made a little subroutine that deletes the datagrid and then makes a new one. Then the scroll bar goes back to the top. But I will try this too...perhaps less code.
|
|
|
|
|
If you are just performing a new query and setting the results to the datagrid then in your routine where you set the datagrids datasource property, always set the datasource to nothing first.
Private Sub FillGrid(dg As DataGrid)
Dim ds As New DataSet
'//Clear Any Data From The Grid
dg.DataSource = Nothing
'//Do Work To Get Data Here
'
'
'//Fill The Grid With Data
dg.DataSource = ds
End Sub
Just An Example. That way your really only had to add one line of code to clear the grid and scrollbar.
|
|
|
|
|
Thank you so much! That did exactly what I wanted and it elminated the need for an extra subroutine.
|
|
|
|
|
|
How can I enumerate a control's properties in .Net?
I bascially want to do this (vb6 code):
*****Start Code*****
ctl = control
strPropName = "value"
For each prop in ctl.properties
If propr.name = strPropName
msgbox prop.value
Exit For
End if
Next prop
*****Start End*****
I'm struggling with this, as it was obvious in VB6!
Thanks
|
|
|
|
|
Use Control.GetType to get the Type of the control, and Type.GetProperties to get an array containing the properties of the control.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Is there any one know how to set the text file to be printed on next new page? I mean if i read certain line contain string start with "*", then i want the line below "*" to be printed on next page.
Any one know how to do this?
|
|
|
|
|
yea use an else if statment to check for more pages. email me if u need more help. pschutt@rxcci.com
|
|
|
|
|
This probally is the stupidest question but I am new to Microsoft VB .Net, and I need help. I know where to put it but I don't know what to put. I just want a sound to play when my Application starts.
|
|
|
|
|
Can you do it in a macro?
WindowEvents_WindowCreated? Oh wait .... in the application your writing(not the enviorment... Ughh)
Yeah - Option One, in your main window load event, Making sure to play it only once.
Option two, have a main function that plays the sound and then loads the form. Make sure you set the startup object to be the main function you just wrote. Just like in VB classic.
|
|
|
|
|
I have been working with VB.NET for a few months coming from vb 4 5 and 6. I have enjoyed the control that I have over the execution on my programs and the level of detail available throught he framework. However, I seem to have a thorn in my side whenever I utilize the datagrid. Indexoutofrange exception seems to pop up out of knowhere and for the life of me I can not properly trap it or handle it in debug mode. I have gotten around other exceptions, has anyone else experienced this? is there something that I would be overlooking or a way to trap.
Thanks
Gregory J Lynch
Hack
|
|
|
|
|
I compiled a DLL using Visual Basic 6. I am unable to call this DLL in OMNIS.
I was told that if a DLL is compiled in VB 6, it is highly likely to be compiled as a COM object. Omnis functions will not work with COM objects.
How do I compile a DLL in VB 6 as a normal DLL?
Can somebody help me out??
Regards,
Vick
|
|
|
|
|
This cannot be done using VB6 alone, which creates only stand-alone EXEs or COM components. Desaware, however, has a product called SpyWorks, that will create Win32 exports of VB DLLs.
http://www.desaware.com/SpyWorksL2.htm
|
|
|
|