|
As far as I can tell, when you create a new class that inherits from System.Windows.Forms.Form, Visual Studio will not automatically generate a default (parameterless) constructor in the code. The direct answer to your question is that, since the code does not already contain a default (parameterless) constructor, adding a new private default constructor is not changing generated code.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Whoops! My bad.
[Edit] Actually, it's in the base Form class. But, you can't remove it if you want the form to show up in the designer. The designer uses only the parameterless constructor to create an instance of the form to show on the design surface. Removing it kills the ability to design the form.
|
|
|
|
|
Hmmm...I actually created a blank VB WinForms project and didn't see any constructors, even in the designer generated file (Form1.Designer.vb). I do see it if I look at the compiled code with Reflector.
Yes, I found that if I created my own private default constructor the code wouldn't compile, throwing errors in the Application.Designer.vb file.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Scott Dorman wrote: Hmmm...I actually created a blank VB WinForms project and didn't see any constructors, even in the designer generated file (Form1.Designer.vb).
I already correct my mistake. It's not in the designer generated file. It's in the base Form class that your Form1 class is inheriting from.
|
|
|
|
|
Maybe I'm missing something. You're trying to create your own Form class, removing the New constructor that doesn't take any parameters, and adding another New constructor that does take a parameter?? Am I correct?
You cannot remove the parameterless New method. Doing so will make the form unusable in the form designer since it will only create an instance of your form using the parameterless New method.
OK, what's the property you're trying to "force" on this form??
|
|
|
|
|
I have and existing form that calls another form which were both designed visually. I need to force a client number when calling this form or we cannot retrieve the correct information.
Humble Programmer
|
|
|
|
|
Simply create a instance variable and a parameter in the form class:
Private _clientNumber as Integer
Public Property ClientNumber() As Integer
Get
Return _clientNumber
End Get
Set(ByVal Value As Integer)
_clientNumber = Value
End Set
End Property
After you instantiate the form, but before you display it, set this value in the calling code. Then use the value stored in the property when you show the form.
|
|
|
|
|
This is actually what we are doing now. What I want to know is there any way that you can say if that does not have a value when the form is shown don't compile throw a compile time error. Like if you did remove the New Sub and made your own with parameters and when you called the class you did not supply the parameter it would blow up.
Humble Programmer
|
|
|
|
|
programmer_vb.net_c++ wrote: What I want to know is there any way that you can say if that does not have a value when the form is shown don't compile throw a compile time error.
Not correctly, no. You would check something like this at runtime, not design time. You'd throw an exception if the proper values were not in place.
|
|
|
|
|
We have a VB6 DLL in production, but, the source code that can be found is missing a function found in the DLL.
The source code has sections of hard-coded SQL statements that are used to extract data from a legacy system (Ingres II).
All I really need is the SQL statements for the missing function.
Does anyone know of a way to open and read the DLL? I have tried notepad, but, it doesn't appear to show me the missing section.
Yes, the code SHOULD have been replaced in SourceSafe, but, it wasn't. And, the 3 most likely developers left the company some time ago.
Thanks,
Tim
modified on Wednesday, October 8, 2008 11:42 AM
|
|
|
|
|
Just a thought - If the SQL was MS SQL2000, I am pretty sure you can use SQL Profiler to dump all sql queries run on the database, which would show the queries actually run by the DLL...
Sql Profiler may be availiable for other DBEngines, but I have only used the one in SQL2000.
|
|
|
|
|
You're best option is to run a tool like SQL Profiler which can show you all of the active database connections and the SQL statements being performed. SQL Profiler specifically is only available for Microsoft SQL Server, but Ingres should have something similar. Red-Gate may also have a similar tool that will work as well.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Ack what a head ache. Profiler could work to get the queries, but of course requires that you know how each part of the logic is called to hit all the different queries/statements.
I feel for ya.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
For those that tried to help, thank you.
If this was a SQLServer database, I could have used Profiler, unfortunately, this is an Ingres II database (legacy, text only environment).
So, since I could see the data for process was generating (the DLL was storing data in SQLServer), I talked to the people working on the legacy system and showed them the data.
From there, I slowly rebuilt the query to produce identical results.
The new query is stored in a table in SQLServer; the DLL will call a stored procedure that returns an SQL statement. If the source data changes, SQL changes are then made in SQL, not in the code itself.
Thanks,
Tim
|
|
|
|
|
Dear All,
I have set a timer for my windows service using Threading.Timer. I set the interval to 10000 that is 10s before finished its current job. The problem is the oCallback is called every 10000, can someone help me so that the oCallback will not fires before finish it current job.
Dim oCallback As New TimerCallback(AddressOf OnTimedEvent)
oTimer = New System.Threading.Timer(oCallback, Nothing, 0, 10000)
Private Sub OnTimedEvent(ByVal state As Object)
'need to stop timer..
EventLog1.WriteEntry("Called")
System.threading.thread.sleep(20000)' just to delay for 20 sec
'start timer back
End Sub
Thank you in advance.
awek
Programmer
Subang Jaya,Selangor, Malaysia
|
|
|
|
|
Hi Can you tell how much time it is taking to process the current job?Is it taking more than 10 sec?
You can declare a boolean variable with value flase.S et it's value to true after completing the current job and check the value of boolean variable if it is true then only move forwad otherwise return from the time function...
|
|
|
|
|
Just a thought, but why not stop the timer in your OnTimedEvent handler?? You've got the thing setup with a callback and an interval, so all you need to do at the end of the job is start the timer. At the beginning of the job, stop it.
|
|
|
|
|
Thanks for your tips. Will try to implement it.
awek
Programmer
Subang Jaya,Selangor, Malaysia
|
|
|
|
|
hi, this is kinda simple in vb6 but in vb.net its a different story. I'm trying to get the
value of the select item in my dropdown list box and try to display the selected item in a label or textbox but I can't find a way to do it. Can anyone help me with this problem?
Here is the sample code I've made to do the thing.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim DbOraConnection As New DBConnection
drpHOList.DataSource = DbOraConnection.stnOraConnect
drpHOList.DataValueField = ("PURCEN_NAME")
drpHOList.DataBind()
End Sub
Protected Sub drpHOList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drpHOList.SelectedIndexChanged
'lblname.Text = drpHOList.SelectedValue
If Not Page.IsPostBack Then
lblname.Text = drpHOList.SelectedItem.Value
End If
End Sub
Hope that you can help me.
Thank you in advance.
|
|
|
|
|
For drop down list (combobox) you can use drpHOList.text
|
|
|
|
|
Hi, the code you gave works. but, only when the form 1st load and when you try to choose another item from the list box. The text in the label wont change its text to value of the item that I choose in the list box.
|
|
|
|
|
HI...
I think you had put that code in form load only... You have to put the same code in
SelectedIndexChanged
event of Dropdownlist also.
In dpListCombo_SelectedIndexChanged
LBlSelectName.text = dpListCombo.text
|
|
|
|
|
Hi all,
i want use Timer control,for Label.
that when the user click the button the label should be appear for 5sec and disappear the label.
this should be base on Button Click only.
Please help me..
thanks in Advance.
JohnDas
|
|
|
|
|
on button click event enable the timer and set it interval properties. Also set it tick event accordingly
for example if you set interval properties to 1000 then set a global variable like
dim i as integer
and on tick event of timer
private sub timer1_tick()
if i=5 then
label1.visible=false
timer1.enabled=false
else
i=i +5
endif
end sub
hope this helps
|
|
|
|
|
Thanks very much, its working fine.
JohnDas
|
|
|
|