|
Luc Pattyn wrote: I am surprised by the combination large+legacy+VB+Vista.
Damn you beat me to it
|
|
|
|
|
Sorry for the sarcastic response above; friends should not let friends post while uncaffeinated.
The application itself is more than 10 years old. It was originally written in VB4, was latter translated into VB6 and, starting about two years ago, translated into VB.Net 3.5. This is the database front end used by the home office of a mid-size brokerage firm and has gone through EXTENSIVE rewrites over the years to accomodate changes in federal regulations and the ignorant whims of Point-Haired Bosses. The EXE of the original, as delivered by the team of contractors, was 1028kb; the most recent VB6 version is 2844kb. Because of the number of cards that make up this mission critical house, I have been very reluctant to make wholesale changes in the code.
In summary, the application is a big, steaming pile sitting on my desk.
In the most recent version (the one in VB.net 3.5) there were some organizational changes. The visual interface (forms, etc.) and central application pieces are in one project, the core functionality and custom components are in another project, database functionality is in a third, and projects exist for interfacing with our document imaging system, our reporting system and our back-office employee management system (don't ask why that was folded in,) all tied together into a single solution. Some order was imposed on the database module, forced largely by the switch from RDO to ADO.Net, but by and large, the code was merely translated rather than redesigned from scratch like it should have been: we simply did not have the time and resources to do that.
It should be possible to redesign the main project to make use of multithreading, but that leads to a rather more substantial problem: my company does not pay for tech training, so I would have to do it on my own and I don't know squat about multi-threading. I'd like to think that I am a pretty competent programmer, but that is never something I've had to do before. Contracting is not a realistic option, as my boss tends to higher whoever has the lowest fee and does not ask my opinion before inking the contract.
I was really hoping that there was a simpler solution.
|
|
|
|
|
Well by lack of any other option you might try to refresh the form and the controls individually.
No guaranty that it will work haven't try'd it.
Other than that you could try to make sure no other form can be displayed over that one.
Again a very bad solution and not sure if it will work.
|
|
|
|
|
if (big if) you have a clear separation between GUI stuff and everything else, then you could use just two threads: the main thread for GUI stuff, one new thread for everything else including database accesses, networking, computations, whatever. All you need then is a good interface between those two, so the back-end can remain what it is and read and write data structures getting/passing information to the front-end GUI. It is not really hard, however there are many ways to do it wrong, and depending on the number of forms/screens you currently have, it may be huge.
You should not attempt this on a big app right away; take your time to get something small to work, so you really understand it and then can judge for yourself.
|
|
|
|
|
Ah, well. Multithreading is something I've been wanting to learn, as it would help in a number of other apps I have to maintain. I just have to work out a way to make this enough of an issue so the PHBs allocate the time and resources I need to get this worked out. (Insert evil smiley here.)
|
|
|
|
|
I'm guessing that's sarcasm.
TechBearSeattle wrote: how to retrofit a massive legacy application
Legacy? with vista Aero interface and vb.net 3.5???
Luc is correct if you want this form to keep updating you'll have to put your code into a separate thread and stop using doevents().
TechBearSeattle wrote: I'm sure I can find a few months to dedicate to the project.
If the project had been designed correctly from the start you wouldn't be in this kind of trouble now.
|
|
|
|
|
Alas, yes: this is a legacy system running on Vista with Aero. See my post above.
|
|
|
|
|
using VB6 and Crystal Report10, Report X contains subreport Y and Z (e.g)
When i click button, it gives error as
"Query Engin Error 'Error Code: 0x800a0e78'
Source Adodb.RecordSet
Description: Operation is not allowed when the object is Closed"
NOTE: When i use break point and parse line be line, then it works fine.
My Code is as:
Public Function ShowNELogReport(ByRef rsNELog As ADODB.Recordset, ByRef rsPower As ADODB.Recordset, ByRef rsSystemStatus As ADODB.Recordset, ByRef rsRequirement As ADODB.Recordset)
Dim Report As New rptLogMain
On Error GoTo Err
With rsNELog
If Not (.BOF Or .EOF) Then
.MoveLast
.MoveNext
'Report.Database.SetDataSource rsSearchReport
Report.Database.SetDataSource rsNELog
Debug.Print Report.Database.Tables.Item(1).Name
'Report.ReadRecords
Report.Subreport1.OpenSubreport.Database.SetDataSource rsPower
Report.Subreport2.OpenSubreport.Database.SetDataSource rsRequirement
Report.Subreport3.OpenSubreport.Database.SetDataSource rsSystemStatus
crViewer.ReportSource = Report
crViewer.ViewReport
Else
MsgBox "Record Not Found", vbInformation
Unload Me
End If
End With
Exit Function
Err:
MsgBox Err.Description
End Function
|
|
|
|
|
hi.. I m working in VB in Visual Studion .Net. In my project I have two forms. I m declaring a public array in form1 which i want to use in 2nd form (form2) also. On form1 i have a button which when clicked form2 will be shown. I want that contents of array in form1 should be acessible in form2 also. But i m facing the problem that how to open form2 on button click in form1 and use array of form1 in form2.
So, Is there any solution for this???
|
|
|
|
|
If the array is declared as public then all you need to do is preface the call to the array with form1
i.e textbox1.text = form1.myarray(0)
|
|
|
|
|
Personally this is a very BAD idea.
Forms are objects that should encapsulate the data within them. At no time should one object just simply reach out and grab hold of data inside of another object. This is really one of the major tenets of OOP design.
That does not mean that you can't talk between forms, but it should be done properly via an established interface.
You should be providing an interface (functions, methods, or custom properties) on your forms for allow that type of communication to happen. This gives you a way to not only gain access between data on forms the proper OOP way, but also gives you the ability to provide data validation, authentication when needed, and also perhaps some contention detection when that may be needed also.
Please, NO public variables on forms! Forms are objects just like a class is. You don't open up a variable inside a class by making it public, you provide an accessor method to get to it. RIGHT? That's how you are doing in in your classes? Please say yes?
Forms are no different.
|
|
|
|
|
What!? I just use Option PublicEverything so I don't have to think!
All kidding aside, though, Ray is right. Just need to make a public accessor for the array, and all is well.
|
|
|
|
|
Actually I think he might be better to just use a seperate module for his public data. The forms should only contain data that is very specific to that particular form (which usually means it doesn't need to be public). Everything else such as functionality should be in modules or classes.
|
|
|
|
|
I can agree there, but then you still should not just reach out form the form and access the public object. It should be passed to the form upon creation via the forms constructor.
NOTHING in my opinion should be simply accessible via being public.
|
|
|
|
|
My Apologies. Of course you are right. You should implement public properties rather than declaring variables Public in any Class. My Bad.
|
|
|
|
|
I want to show the WaitCursor when my app starts while it does some preparations before it shows the main form and starts the message thread.
So I can't use MyForm.Cursor = Cursors.WaitCursor because the message thread is not running yet.
Is there a way to change the windows cursor in another way?
|
|
|
|
|
Windows.Forms.Cursor.Current = Windows.Forms.Cursors.WaitCursor
Windows.Forms.Cursor.Show()
'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
|
|
|
|
|
It doesn't work. Cursor stays normal.
|
|
|
|
|
the normal approach is to show a splash screen, which may or may not be animated. One way is like this:
Main() {
SplashScreen splash=new SplashScreen();
splash.Show();
SlowForm form=new SlowForm(splash);
Application.Run(form);
}
and the SlowForm could close the splash when it is far enough in its creation process.
BTW: if the SlowForm constructor is slow, you should consider postponing its slower parts ro a later event (Load, Shown) or even to a separate Thread.
PS: sorry, my example is using C#, you'll have to find the way to do something similar in VB.NET
modified on Monday, January 11, 2010 6:10 PM
|
|
|
|
|
Thanks, will try something like this.
|
|
|
|
|
Dear All,
I have a SQL database with 3 columns A, B, C. Under these 3 columns, there are 100 entries.
I want each row to be printed on each page of crystal report, so that i get a separate page for each row entries of the database.
Can someone suggest me how to implement this?
Regards
R.S.
|
|
|
|
|
You can check with crystal reports, from report field explorer, there is a field called Group Fields, there if you give your field as a group field, then your reports will be seperated by the same manner.
For Details, suppose your report like
S.No..Name...............Category
1.....Mr.Dave Kresoik....MVP
2.....You................Learner
3.....Me.................Learner
Now I added a Group By Field as Category, then PAGE-1
S.No..Name...............Category
1.....Mr.Dave Kresoik....MVP
And PAGE-2
S.No..Name...............Category
1.....You................Learner
2.....Me.................Learner
|
|
|
|
|
H0=[3/(5*sqrt(2)),4/5;-1/20,-3/(10*sqrt(2))];
H1=[3/(5*sqrt(2)),0;9/20,1/sqrt(2)];
H2=[0,0;9/20,-3/(10*sqrt(2))];
H3=[0,0;-1/20,0];
G0=[-1/20,-3/(10*sqrt(2));1/(10*sqrt(2)),3/10];
G1=[9/20,-1/sqrt(2);-9/(10*sqrt(2)),0];
G2=[9/20,-3/(10*sqrt(2));9/(10*sqrt(2)),-3/10];
G3=[-1/20,0;-1/(10*sqrt(2)),0];
H=[H0,H1,H2,H3];
G=[G0,G1,G2,G3];
B=zeros(2*k1,2*k2);
for i=1:4:2*k1
if (i+7)>(2*k2)
B(i:i+1,i:i+3)=H(1:2,1:4);
B(i+2:i+3,i:i+3)=G(1:2,1:4);
B(i:i+1,1:4)=H(1:2,5:8);
B(i+2:i+3,1:4)=G(1:2,5:8);
else
B(i:i+1,i:i+7)=H;
B(i+2:i+3,i:i+7)=G;
end
end
and the code
[k1,k2]=size(A);
WW2=gen2(k1/2,k2/2);
FF=ipermutesub(A);
FT=FF';
EE=ipermute2(FT);
DPP=WW2'*EE;
DD=icspreproc1(DPP);
CPP=DD';
CC=ipermute2(CPP);
AAP=WW2'*CC;
B=icspreproc1(AAP);
|
|
|
|
|
Soooooooo......what's the question?
|
|
|
|
|
I have a context menu running for a vb.net windows service controller I've created.
Folks can turn the windows service on and off with the application. I change the caption for the local mene each time the user changes the service status. (Startup service/ shutdown service)
This works great until somebody changes the service status independantly of my service controller. Then the captions don't match.
I'd like to capture the "right click" event of my context menu, so to speak, to make certain I have my service's status displayed correctly. I don't know how to do this with a dynamically created context menu.
I can add events associated with specific menuitem w/i my context menu without issue.
|
|
|
|
|