|
hi,
i want to prevent my application from raising events before it is fully loaded
my problem is that for ex. the TextBox1_TextChanged is raised during InitializeComponent() which is not necessary, so it just adds to the application loading time
the ideal solution would be something like application.dontDoEvents, but i guess it's not that simple
thanks
|
|
|
|
|
You do not want to disable program events before the program initializes, because your program initializing is making hundreds of events. Your best bet would be to just ignore it, unless it is taking five extra minutes to load your program. The other option would be to selectively choose which events should not be run through the WndProc.
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
You disable raising events anyway, so it's a moot question.
If you want to improve your app's startup time, then you can read this[^] list of guidelines.
If you're trying not to do something during startup in a TextChanged event, then set a flag in your apps's Startup (before Application.Run() is called) or in the startup Form's Load event that says your app is starting up. THen, in each of the event handlers you don't want code to run in, check this flag first and run the code depending on that flag.
Better yet, your event handler code should be written to check for minimum requirements before executing the real "meat" of the event handler.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Declare a private boolean variable and set it to false (which is by default) before the InitializeComponent() and set the same boolean variable to true after the InitializeComponent()
Then in the TextBox1_TextChanged event check with the variable Boolean Variable, Such that the code is executed only if the condition is true.
-------------------------
m_IsInitializing = True
InitializeComponent()
m_IsInitializing = False
Private Sub txtBetween1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBetween1.TextChanged
If Not m_IsInitializing Then
'ur code
End If
End Sub
---------------------------
Hope that this has solved ur problem;
Cheers
Regards..
Hari..
Hari Prasad...
|
|
|
|
|
i've done that, but i thought there was a more elegant way of doing it rather that cheching if a variable is true everytime such an event is raised
oh well..
thanks anyway
|
|
|
|
|
Hi my web config for handling admin to the site is something like this:
<add key="ADMIN_USERNAME" value="admin">
------------------
session is created after reading from database.
--------------------
Session("username") = dr("Username")
----------------
checking if the session belong to admin ( if yes redirect to admin page
--------------
and in home page i am storing the
If Session("UserName") = ConfigurationSettings.AppSettings("ADMIN_USERNAME") Then
strAdminLink = " Admin"
End If
but its not working i dont may be i dont know web.config works.
please help.
thanks
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
---
b { font-weight: normal; }
|
|
|
|
|
well its not taking me to admin page and i dont know where to specify admin username and password. do i need to store in db or user and pass in web.config.
|
|
|
|
|
You are trying to read the user name from web.config. Have you put a value in web.config? What does your web.config file look like?
---
b { font-weight: normal; }
|
|
|
|
|
ahh sorry i forgot to add that web config line...
its
<add key="ADMIN_USERNAME" value="admin">
i am thinking may be i need to put username and password in the value field just dont know much about web.config
please help.
|
|
|
|
|
The value property in the tag in web.config is exactly what you get from the AppSettings collection. If you have the user name in the session variable that you compare with the value from the web.config, you should have the user name in web.config.
---
b { font-weight: normal; }
|
|
|
|
|
I need to know how I would setup my program so that after I make it a .exe and install it on another computer it give me the option to connect to a database on a server? Can someone guide me to a sample or a link as to how to do this.
Thank You
WackoWolf
Joseph L. Gelsomino
|
|
|
|
|
Try looking into ADO.NET. That is what you will need to connect to databases.
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
First You need to create an ODBC Connection in the machine plus depending on the type of database such as Oracle, MS SqL, Teradata, Access. For Oracle systems you need the oracle client plus the proper DSN path in the oracle DSN folder. For MS SQL you need the ODBC drivers plus the PATH for the server. Hope this help.
Hear,See,Learn,Understand,Practice <hslup>
Many can be good,but only ONE can be the best keep practicing
|
|
|
|
|
... when and which Right, Left or Wheel mouse buttons have been used? I'm asking because the control does recongnizes those first three buttons but not the XButton1 and 2 that are used by many as Back and Forward buttons. I would like to get those two working as well, since it is a request from some using my browser.
Thanks for any help.
-- modified at 17:26 Saturday 18th March, 2006
|
|
|
|
|
Well I feel kind of silly because just a few hours after I posted this question I found the answer I was looking for and again with the information I found on this site I was able to do what my users wanted. But in my defence I did look around for many hours before asking!
Let me take the time though to say that this site and the people coming to it to help absolutely ROCK! I have not found any other site on the internet that helps those in need as much as this one does. Keep up the wonderful work people.
|
|
|
|
|
I don't get it...I'm pretty new to VB.NET and programming in general and I've written this class that is supposed to get TCP statistics:
'------------------HERE IT BEGINS------------------------------------
Imports System.net
Imports System.net.NetworkInformation
Public Class TcpStats
Public stats As Long()
Public Sub ShowTcpStats(ByVal version As NetworkInterfaceComponent)
Try
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties
Dim tcpstat As TcpStatistics
Select Case version
Case NetworkInterfaceComponent.IPv4
tcpstat = properties.GetTcpIPv4Statistics
Case NetworkInterfaceComponent.IPv6
tcpstat = properties.GetTcpIPv6Statistics
Case Else
Throw New ArgumentException("version")
End Select
stats(0) = tcpstat.MinimumTransmissionTimeout
stats(1) = tcpstat.MaximumTransmissionTimeout
stats(2) = tcpstat.CurrentConnections
stats(3) = tcpstat.CumulativeConnections
stats(4) = tcpstat.ConnectionsInitiated
stats(5) = tcpstat.ConnectionsAccepted
stats(6) = tcpstat.FailedConnectionAttempts
stats(7) = tcpstat.ResetConnections
stats(8) = tcpstat.SegmentsReceived
stats(9) = tcpstat.SegmentsSent
stats(10) = tcpstat.SegmentsResent
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
--------------------HERE IT ENDS--------------------------------
This is how i instantiate the class from the main form:
------------------- HERE IT BEGINS------------------------------
Imports System.net
Imports System.net.NetworkInformation
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Instantiating my class
Dim tcpstats As New TcpStats
'Calling the ShowTcpStats procedure in my class
tcpstats.ShowTcpStats(NetworkInterfaceComponent.IPv4)
'Here is a list into which I add the statistics
Me.lstTcpStats.Items.Add(tcpstats.stats(0))
Me.lstTcpStats.Items.Add(tcpstats.stats(1))
Me.lstTcpStats.Items.Add(tcpstats.stats(2))
'And so on....
End Sub
End Class
-------------------HERE IT ENDS----------------------------------
problem is, when I execute the program the properties object of the IPGlobalProperties class is Nothing
so i get a NullReferenceExeption.
Can anyone tell me why? What I'm doing wrong?
Kind regards V
|
|
|
|
|
How to use Inheritance in VB 6.0?
It's very easy:-
Declare an Global variable and use it whenever needed
But in case of forms, make few changes only:-
Declare form variable without New keyword.
Like, Dim Fr as Form1.
And the Form1 is Inherited. Now i can do any thing with Form1. I can get any thing like Form backColor, ForColor, Size, Location, etc. Like you can see it in my " Floating Control Box" Article (named - Window Control 1.0).
It was very hard use Inheritance in Visual Basic 6.0.
But known it is very ease to use Inheritance.
-- modified at 5:59 Sunday 19th March, 2006
|
|
|
|
|
Is there is a point to this little speech of yours?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I open a Form from another Form?
newtWales
|
|
|
|
|
Create a new instance of the form you would like to open and call the Show ( or ShowDialog) method on the created object.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Dim newForm As New Form2
newForm.Show()
' or
Dim dr As DialogResult
dr = newForm.ShowDialog()
' Do something with the DialogResult...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thats for version 1 and 1.1 but in 2 i have noticed that u can do it the old fationed way like in vb6 where u dont have to do the whole Dim newForm As New Form2. u can just newForm.Show().
|
|
|
|
|
ACtually, the libraries in VB.NET2005 are doing that very thing for you. Just because you CAN do it in VB.NET, doesn't mean you SHOULD be doing it.
Any VB6 project run through the Upgrade Wizard in VS.NET 2002, 2003, or 2005, will do the same thing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I noticed that when I run some Dotnet programs the icons in the background (XP desktop) flicker regularly.
I tried to find out what is happening and I managed to reproduce the problem with five lines of codes.
I hopesomeone will be kind enough to test that on their machine and tell me if they reproduce it or not.
You just need to
1 - create a new Windows Forms application.
2 - add a numericupdown control in the middle of the form
3 - set the numericupdown1 maximum to 1000
4 - Add this code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
For i As Integer = 1 To NumericUpDown1.Value
e.Graphics.DrawLine(Pens.Red, 10 + i, 10, 10 + i, 10 + i)
Next
End Sub
Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
Me.Invalidate()
End Sub
Then when you click on the NumericDown control and reach 150 (on my machine) the icons on the background are starting to refresh...
Do you reproduce that ?
|
|
|
|