|
Your code would be better written as:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer
i = Val(Me.txtErrMsg.Text)
If i = 4 Then
Me.txtErrMsg.Text = "Now throwing Exception"
Else
Me.txtErrMsg.Text = "Normal"
End If
End Sub
Exceptions are expensive. They take many clock cycles as the runtime has to figure out how to back out of what ever it was doing.
|
|
|
|
|
I would like to make a game loop but at the same time I need complete control over the form. I used the following concept but ran into a serious problem. The moment the loop is entered nothing else responds.
This is a windows forms application using vb.net 2008.
I added a module
Module Game
Public Finished as Boolean = False
Public Sub Start()
While Not Finished
My.Application.DoEvents()
End While
End Sub
End Module
The 'Start' sub procedure is called from the forms load even and that is the entire program. When run, the form does not even show up. I don't want to add Me.Show() before running the loop since it defeats the purpose if it's stuck anyway. I need the loop to run while at the same time I need full access to the controls on the form without any stalling or pausing. Does anyone know how to make a properly functioning loop run in parallel to the form?
|
|
|
|
|
You should be spawning a thread for your loop, there are many articles and threads here to help with threading.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You should look into the BackgroundWorker object if you are on .NET 2 or above. You can do it in any version with raw threads, but BackgroundWorker is MUCH easier to manage.
|
|
|
|
|
i want to capture video using pocket pc (WM5) , encode it then store it and transmit it using UDP packets
@ the laptop side the packets'll be recieved , decode and display them one at time
which means streaming technique in delivering the video ;
split the video into parts , transmit these parts in succession (using UDP packets) and enable the receiver to decode and playback the video as these parts are received without having to wait for the entire video to be delivered (on pocket pc side: capturing video - encoding - storing - sending ) so the streaming in sending only :
1- partition the compressed video into UDP packets.
2-start delivery of these packets.
3-begin decoding and playback at the receiver while is still being delivered.
.i've problem in disply the video on the desktop as soon as the first packet is recieved
note
i use VB.NET or C# no problem
plz i need ur help
thanks alot
modified on Friday, August 8, 2008 9:44 AM
|
|
|
|
|
salam ellayan wrote: i've problem in disply the video on the desktop as soon as the first packet is recieved
Well, that's a bit vague. What kind of problem?
|
|
|
|
|
i want to capture video using pocket pc (WM5) , encode it then store it and transmit it using UDP packets
@ the laptop side the packets'll be recieved , decode and display them one at time
which means streaming technique in delivering the video ;
split the video into parts , transmit these parts in succession (using UDP packets) and enable the receiver to decode and playback the video as these parts are received without having to wait for the entire video to be delivered (on pocket pc side: capturing video - encoding - storing - sending ) so the streaming in sending only :
1- partition the compressed video into UDP packets.
2-start delivery of these packets.
3-begin decoding and playback at the receiver while is still being delivered.
.i've problem in disply the video on the desktop as soon as the first packet is recieved
note
i use VB.NET or C# no problem
plz i need ur help
thanks alot
|
|
|
|
|
Hi All;
I'm running some query's against SQL 2005 server. When I run the query's in SQL server they return Null values because there is no data yet.
In my VB code the same query's generate the System.IndexOutOfRangeException: There is no row at position 0. error. I have not been able to come up with a way deal with this.
It seems to happen before this fill line happens
datafromDS(0) = Me.DataSet11.Tables("tblMyTable").Rows(0).Item(0)
Any suggestions on how to handle this. There are times when new records have been added that have Null data in them.
TIA
Rafone
Statistics are like bikini's...
What the reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
First make sure you have a table, then check the rows
If not me.dataset11.tables.contains("tblMyTable") Then
'blow up no table -- or however you want to handle it
Exit Sub
ElseIf me.dataset11.tables("tblMyTable").rows.count = 0 Then
'blow up no rows -- or however you want to handle it
Exit Sub
End If
'Process Records
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Also check the value of Item(0) against DBNull.Value and the target type.
|
|
|
|
|
After going back and trying this again this trap is working. Thanks.
many hours later...
meh
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
|
Perhaps you should ask the author of that article.
|
|
|
|
|
There is a message board at the bottom of the article. Post there and maybe the author will reply.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi Friends,
I want to send email from VB6. It should open the default mail client.
And I want to format the body with tab and want to add image also.
How to achieve this ?
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
|
Hi,
thanks buddy.
But i want in VB 6.
not in .Net..
Any other help ?
Thanks..
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
It's the exact same thing. Instead of using .Net's Process class, use the ShellExecute API, or the Shell function.
|
|
|
|
|
Thanks,
but in that cant put image or cant have html mail body.
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Hi group,
we have a userdefined control (called e.g. LabelAndMore) which contains a Label and other controls. When I apply this userdefined ctrl LabelAndMore in eg. a form I need to set the properties of the label.
Of course, we could add properties like Label_Text and Label_AutoSize in LabelAndMore. For a label this would be ok. However, if a more complex control with more relevant properties is needed instead of a label, all its properties would have to be added in LabelAndMore just to mirror the already existing properties of the complex control to LabelAndMore.
Thus we had the idea to add the property
Public Property Label() As Label
Get
Return Me.Label1
End Get
Set(ByVal value As Label)
Me.Label1 = value
End Set
End Property
in LabelAndMore. At the first glance this approach looks quite fine. When I add a LabelAndMore to e.g. a form and look at the property list of the inserted instance of LabelAndMore, the new property Label shows. It has a plus symbol in front of it. Expanding it one gets all the properties of the label. But unfortunately the designer does not create code in Form1.Designer.vb for the changed properties of the Label within LabelAndMore.
What do we have to do so that changes of the properties of Label in LabelAndMore are added to the code created by the designer?
I guess it is possible because a split container does it. It consists two panels called Panel1 and Panel2 and the changes of their properties are added in the code created by the designer.
Me.SplitContainer1.Panel2.Enabled = False
Kind regards and thanks in advance.
Michael
(VB .net 3.5)
|
|
|
|
|
Finilly I have found a solution which seems to work. I've had a look into the source code of the .net framework for the SplitContainer mentioned above. It shows
[
SRCategory(SR.CatAppearance),
SRDescription(SR.SplitContainerPanel1Descr),
Localizable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
]
public SplitterPanel Panel1 {
get {
return this.panel1;
}
}
If I use this in my case the problem is solved:
< _
System.ComponentModel.Localizable(False), _
System.ComponentModel.DesignerSerializationVisibility( _
System.ComponentModel.DesignerSerializationVisibility.Content) _
> _
Public ReadOnly Property Label() As Label
Get
Return Me.Label1
End Get
End Property
Michael
Some infos from the VS 2008 docu:
' HINT from VS docu for "SRCategory"
' (no entry available)
' HINT from VS2008 docu for "SRDescriptionAttribute Class"
' Provides an attribute for use in upgrading Visual Basic 6.0 applications to Visual Basic 2008.
' HINT from VS2008 docu for "DesignerSerializationVisibilityAttribute Class"
' When a serializer persists the persistable state of a design mode document, it often adds
' code to the initialization method of components to persist values of properties that have
' been set at design time. This happens by default for most basic types, if no attribute has
' been set to direct other behavior.
' With the DesignerSerializationVisibilityAttribute, you can indicate whether the value for a
' property is Visible, and should be persisted in initialization code, Hidden, and should not
' be persisted in initialization code, or consists of Content, which should have initialization
' code generated for each public, not hidden property of the object assigned to the property.
' HINT from VS2008 docu for "LocalizableAttribute class":
' When code is generated for a component, members that are marked with the LocalizableAttribute
' set to true have their property values saved in resource files. You can localize these resource
' files without modifying the code.
' By default, members that have no localizable attribute or are marked with the LocalizableAttribute
' set to false will have their property values persisted to code, if the data type allows.
|
|
|
|
|
hi all,
am working on vb.net2.0 , a facing noe regler issue in filtering the names
for eample in my Database , Location name is CANADA, when i click CANADA location i want to dispaly the values depends on Location.
in databse 10 diffent names are there, need to dispaly only 3 namesPls help me
Regards
Vidhish
|
|
|
|
|
A SQL query like select * from databasetable where country <> 'Canada' ?
|
|
|
|
|
i am having a client server application where user will input some data from their office and i suppose to save their data into a sql server 2005 express, where located in a different place using internet .
can any one suggest how to achice this goal, please.
urgent!
thank you
|
|
|
|
|
Just connect the application to the database. It isn't hard.
|
|
|
|