Jump to content
Xtreme .Net Talk

GornHorse

Avatar/Signature
  • Posts

    105
  • Joined

  • Last visited

Everything posted by GornHorse

  1. Ok... So, to probably make things worse... this is my new code. Bare in mind that this is still not making the textbox display the text each time the timer.elapsed event is handled, but I think i'm headed in the right direction - but I definately still need more help!! Dim myMainFrm As MADUSA_MainMenu Public Thread1 As Threading.Thread Dim MADConnector As clsMADConnObj.Connection Private Event FinishedLoading() Dim curtime As DateTime Dim Timer As Timers.Timer Dim t_StartTime As DateTime Dim t As TimeSpan Dim m_counter As Integer Public Sub New(ByVal parent As MADUSA_MainMenu) MyBase.New() myMainFrm = parent MADConnector = myMainFrm.GetMADConnector 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call Thread1 = New System.Threading.Thread(AddressOf CreateDDBatch) Thread1.Name = "Create DD Batch Thread" AddHandler FinishedLoading, AddressOf FinishedLoadingEH t_StartTime = System.DateTime.Now Timer1Start() Thread1.Start() End Sub Private Sub CreateDDBatch() Dim DDProcessor As New clsID_DirectDebit_AutoProcessor.AutoProcessor(MADConnector, myMainFrm.GetUsername, myMainFrm.GetPassword) RaiseEvent FinishedLoading() End Sub Sub FinishedLoadingEH() Timer.Enabled = False Timer.Stop() Me.Cursor = Windows.Forms.Cursors.Default Me.btnClose.Enabled = True Thread1.Abort() End Sub Private Sub Timer1Start() Timer = New System.Timers.Timer(500) Timer.Enabled = True Timer.SynchronizingObject = myMainFrm AddHandler Timer.Elapsed, AddressOf TimerTick Timer.Enabled = True Timer.Start() End Sub Private Sub TimerTick(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Try Dim t_CurrentTime As DateTime = e.SignalTime Dim t_ElapsedTime As TimeSpan = t_CurrentTime.Subtract(t_StartTime) t = t_ElapsedTime UseDelegate() Catch ex As Exception End Try End Sub Delegate Sub UpdateTextbox(ByVal str As String) Private Function UseDelegate() Dim objUpdater As New Updater(Me) Dim objDelegator As UpdateTextbox objDelegator = New UpdateTextbox(AddressOf objUpdater.WriteSomething) objDelegator.Invoke(t.ToString) End Function Class Updater Dim sub_Parent As MADUSA_DirectDebitProcess_Timer Public Sub New(ByVal subp As MADUSA_DirectDebitProcess_Timer) sub_Parent = subp End Sub Public Sub WriteSomething(ByVal strToWrite As String) sub_Parent.tbTimer.Text = strToWrite End Sub End Class Perhaps with this code, someone may be able to give me a hint??!! Thanks again, Michelle
  2. Hi there... Ok, so there have been a few bits of info here... but, I am a bit confused now. I know what I need to do, and that is to get the textbox to display the elapsed time each time the timer.elapsed event is handled. Forget about the threading - I've got that working. I just need a piece of code to help me get the textbox to display the text properly. Now, I am assuming from what I have read that I need to use the textbox.Invoke() method, but, I have no idea what to do with it! I have to pass it a system.delegate, but what is it? You've seen my code above, should I pass it one of those methods? Please help me with this - I really need to get this working. Thanks, Michelle
  3. Hi Toni, To explain what it is that I am trying to do... I have a thread, call this ThreadClassRunner. When the ThreadClassRunner starts, it runs a particular function from a referenced class. I also have a Timers.Timer that is to tick over to calculate the elapsed time taken for the function to complete - this can be up to several hours. I have a textbox on my form that I want to update each time the timer.elapsed event fires so that the users are aware of a) the fact that the function is still running, and b) to inform them of how long the function is taking to run. I know that the elapsed event continues to fire while the ThreadClassRunner is running because i a) created a console application that dumped output to the screen so I know what was happening, and this indicated that yes, the elapsed event continues to be handled correctly while the ThreadClassRunner is running. And, b) within my actual application, i ran a trace to the event log, and this also indicated that the elapsed event was correctly being handled while the ThreadClassRunner was running. So, the timer is correctly handling the elapsed event. My problem is that the textbox (which i want the elapsed time to display in) is not refreshing each time the elapsed event is being handled. I can't understand WHY this is happening, and I haven't been able to find to much info about how to fix it. I don't understand how the textbox.Invoke() method works, and therefore, would really appreciate some more help with this. Thanks. BTW, I have been looking though the info that you provided links to, and it just seems to be help on the threading. I have the threading working - i just need to get the display working. Please remember that I do not create the timer on a thread, therefore, I would assume that the elapsed event is not being handled on a thread either. The only object in the application that is running on a thread is the class's function which runs on the ThreadClassRunner.
  4. Further to problem... Hi there. Well, I have figured out what the problem is, but don't know how to fix it!! I have slightly modified the code from above, such that the timer does not run on a separate thread - i just call Timer1Start() instead of ThreadTimer.Start(). Now, in remembering that, the timer does appear to handle the timer.elapsed event continually whilst the thread is running (calling the class). The reason that I know this is because I created a small console application using exactly the same code as my windows app, and dumped to the console a) when the thread begins, b) an incrementing int when the timer.elapsed event is called, and, c) when the thread finishes. This shows the output as... Therefore, the timer does increment whilst the thread is running. My problem now appears to be that when the timer.elapsed event is handles, I want a textbox on my windows form to increment each time the event is handled so the user knows something is happening. What is happening, though, is that once the class is called, the textbox stops refreshing with the new value. It only catches up once the class is finished being called. I tried using the following lines of code, which, according to other threads, should have worked: Timer.SynchronizingObject = Me and Timer.SynchronizingObject = tbTimer But, neither of them made the program run any differently. How on earth can I get the tbTimer textbox to display the increments each time the timer.elapsed event is handled - because, the event is being handled, the textbox just isn't displaying the new text. Thanks in advance, Michelle PS: Please respond ASAP, this is rather urgent!!
  5. Hi There, I have a thread which executes a class. I have another thread which starts a timer (system.timers.time). I also have a textbox on the form which, when the elapsed event of the timer is called, will increment. Basically, what I want to be able to do is graphically represent to the user that the process is running (because this process can take several hours to run), and to display the elapsed time. The problem I have, is that the class thread starts, and then the timer thread starts; and the timer clicks over a few increments, and then doesn't get called for a while (while the class is being executed), and then, once the class has finished executing, the timer 'catches up', and quickly increments to the actual elapsed time, and then all threads are stopped as a result of calling the FinishedLoading event handler. I don't know how I should call get this working so that the timer can continue to increment whilst the class is being executed. My code snippet is as follows: public Thread1 as Threading.Thread public ThreadTimer as Threading.Thread private event FinishedLoading() dim Timer as Timers.Timer Public Sub New(byval parent as frmMain) Thread1 = new System.Threading.Thread(AddressOf CreateDDBatch) ThreadTimer = new System.Threading.Thread(AddressOf Timer1Start) AddHandler FinishedLoading, AddressOf FinishedLoadingEH Thread1.Start() ThreadTimer.Start() End Sub Private Sub CreateDDBatch() Dim DDProcessor as new clsID_DD_AutoProcessor(username, password) RaiseEvent FinishedLoading() End Sub Sub FinishedLoadingEH() ThreadTimer.Abort() Timer1.Stop() Me.Cursor = Windows.Forms.Cursors.Default Me.btnClose.Enabled = True Thread1.Abort() End Sub Private Sub Timer1Start() Timer = New System.Timers.Timer(100) AddHandler Timer.Elapsed, AddressOf TimerTick Timer.Start() End Sub Private Sub TimerTick(ByVal sender as Object, ByVal e as Timers.ElapsedEventArgs) Try tbTimer.text = cint(tbTimer.text) + 1 Catch ex as Exception End Try End Sub Please try and respond asap with some assistance. Thanks very much, Michelle
  6. Hi There, I have two tables on the same asp.net page. One, tblAccounts, and the other tblDocs. tblAccounts has textboxes & dropdowns in it for the user to provide data. It has a radiobuttonlist that is autopostback, that determines which textbox controls are visible within the next column of the table. The visible textbox has an autopostback on it which creates a new table row ready for data entry. Once the autopostback of the visible control is called, a check is performed - if a result is found, data is populated in the tblDocs. tblDocs has two buttons within its' last column, btnYes and btnNo. On the postback, I dynamically recreate the tblAccounts, but I cannot dynamically recreate the tblDocs, because when I do, it affects the action of the autopostback that is set up for the radiobuttons in the tblAccounts. I have included part of my code as a txt attachment. The problem with this is, that when the main button is pressed, the postback occurs, but no it does not register that the checkbox has been selected , because the tblDocs has not been recreated. I need a way of recreating the tblDocs on each postback without it affecting the way that the controls in tblAccounts are supposed to function. If you need further info on this, let me know. P.S. This is urgent!!?? AttachedCode.txt
  7. Ok, thanks for that. How do I turn off the hexadecimal display?
  8. Hi There, I have VS.NET 2002 with .NET Framework 1.1 & .NET SDK 1.1. I can't be sure when this first started, but it hasn't been for too long - it may have started when I upgraded to the 1.1 Framework. Anyway, I am hoping someone may know how to fix this annoying problem. When I run through debug (either windows app or asp.net, it doesn't matter), whenever I look at the debug value of an anything other than a string (it doesn't matter if the string contains a number, it's just if what i'm looking at is numerical, not character), it doesn't display the actual value, it displays "&H2" or "&H1" etc. This is extremely annoying when trying to debug - I need it to show the actual value that the variable holds. Has anyone had this same problem and knows how to fix it? A prompt response would be greatly appreciated. Regards, Michelle
  9. Ok, so it was just MDI. Sorry :-\
  10. Hi There, I have a parent form, MAD_Main, and another form MAD_Member. My parent has a menu and a toolbar on it. When the user clicks on the 'member' button in the toolbar, i want the MAD_Member form to appear. However, i need it to appear maximised, but only to the size of the parents' remaining space. Ie, the child, MAD_Member, needs to appear covering the entire space from the bottom of the toolbar until the bottom of the form. It also needs to appear within this space, and be unable to be dragged anywhere out of this area. How do I achieve this? Although this child form needs to appear maximisied, and is not able to be moved from anyhwere out of the available space, i also need it to be able to be minimised, and instead of the form appearing in the task bar, it needs to appear at the bottom of the form (looking the same way as it would in the task bar), so that if the user then clicks on the minimised form, it would once again maximise to the original position. Please offer as much assistance with this as possible. I hope my description makes sense. Regards, Michelle
  11. G'Day, Ok. Something that I can't find much info on, but am hoping someone has the skills for me... I have a custom combobox (cbDB) control that has several child controls. One of these child controls, btnPoster is an htmlInputButton. Within my asp.net application, the combobox control is added to the form, but in the codebehind, I reference the child control as follows: public withevents cbDBBtnPoster as new htmlInputButton Then, I assign it the following: cbDBBtnPoster = cbDb.btnPoster Now, as this child control, cbDBBtnPoster is not rendered in the form, I need to be able to reference this from the client-side through a javascript function. I have tried several alternatives to get this control to be able to be referenced from the client-side, and am now up to this one, which i believe is the most promising option, but just trying to figure it out is, I fear, out of my depth... That's where you come in. Anyway, in the form_load event (after i have declared the control and assigned its' value), i have the following: Page.Controls.Add(cbDBBtnPoster) Then, when i run the application, i get the following error: 'A control cannot modify its parents control collections.' The stack trace is as follows: this.controls.add(btnPoster); (NB: this stack trace references the control class where the btnPoster child control is added to the control). I know that this has something to do with the fact that btnPoster is a child control, but how can i ensure that the cbDBBtnPoster control will be able to be referenced by the client-side? BTW, This is really urgent... Cheers, Michelle
  12. Ok, Perhaps you can scratch that last query... maybe. I have done this... Function DumpData(btn){ btn.click(); } Except, now i get the error: cbDBButton is undefined. Please help??!! Thanks again, Michelle
  13. G'Day, Thanks for that. Just one quick question (to prove my uselessness), how do i then use the paramter in javascript? How do i pass this parameter and fire the .click() event? Thanks very much, Michelle
  14. G'Day, I have a combobox that has the following child controls - cbDBButton (HtmlInputButton), cbDBHidden (HtmlInputText), and cbDBText (TextBox). I have declared each of these child controls on the server-side. Ie, cbDBButton is declared as: Public WithEvents cbDBButton as new System.Web.UI.HtmlControls.HtmlInputButton Then, in the page_load, i declare the following: cbDBButton = cbDB.ProcessButton cbDBButton.ID = "cbDBButton" cbDBButton.Attributes("runat") = "server" cbDBHidden = cbDB.Hidden cbDBText = cbDB.TextBox cbDBText.Attributes("onchange") = "DumpData();" '(NB that cbDB is the combobox control) Ok, now the DumpData() function gets called fine (javascript). However, what i need to do from here is force the cbDBButton's serverclick event, so that it can call the sub which handles the event. I have tried the following: Document.Form1.cbDBButton.click(); But, i get the following error: 'Document.Form1.cbDBButton' is null or not an object. How can i force the cbDBButton.click() event from the client without getting this error? A quick reply would be excellent. Ta, Michelle
  15. Hi There, It is OK now, i have figured it out. There were some articles regarding this for use with straight datagrids, so I slightly modified the format, and figured out all I had to do was pass the 'imageurl' the id of the image, and use the codebehind on the other url to just retrieve the image. It is a two-step process, but works very well. If anyone is interested, go to http://aspalliance.com/141 Cheers, Michelle
  16. I have a datatable which is the data source for a datagrid within my asp.net page. In vb.net, how can i read the image data out of the sql server, and them dump it into a the datatable. And, how do i set up the datagrid to be able to appropriately read the image information out of the datatable? My image is held within my sql database as an 'image' type. I have read all the articles I can find, and all they do is show how to display 1 image onto the screen, but i need to show each image (specific to each record) firstly within a datatable, and then databind this to the datagrid. Please offer some assistance with this extremely quickly??!! Thanks in advance, Michelle
  17. Hi There, I need to have a .aspx page used as a modal dialog to indicate to the user that their request is being processed in the background. From the main page, i have the following javascript: var vreturn = window.showModalDialog("REMS_Result.aspx", self, ""); This opens the modal fine, but the modal will not reference the opener as existing, i keep getting a null or empty error when i try to reference it. Within my modal, i have the following code... function setupFnc(){ var opener = window.DialogArguments; var val = opener.Form1.tbhidden.value; while (val != "complete") { val = opener.Form1.tbhidden.value; } window.close(); } What am i doing wrong? If there is a better way of doing this, please let me know! Cheers, Michelle
  18. Hi There, I have a report, and i have a barcode field which the font is set to be code 3 of 9. This displays excellently, but whenever i go to print the thing, on any type of laser or ink jet, including a brand new HP, it prints the barcode field in the default Arial font. I read somewhere that this should be overcome by making the field have the following function: "*" + {tbl1.Barcode} + "*" However, this still prints in Arial, except, now i have *'s at the beginning and end of the barcode text. How can i get crystal to actually print in the code 3 of 9 format? I know that it is not the printer, because i ran a test from wordpad and printed the barcode in code 3 of 9, and it printed perfectly. So, i have no idea what to do, and am hoping that someone may be able to offer some helpful assistance. Thanks, Michelle
  19. Hi There, My report displays excellently, and all i want to do is have this report print automatically. Eg, the report to display and print all within the FormLoad event. I have the report displayed and everything, and this is what i have for the print... oRpt.PrintOptions.PaperSize = PaperSize.PaperA4 oRpt.PrintToPrinter(1, True, 1, 1) Now, when i try to run this, i get the error telling me that there is no default printer installed (however, the users' system does have a default printer set). Anyway, how do i get crystal to display the users' print dialog box so that they can select the printer they wish the report to print to? Another question, i tried to list the installed printers, and it said that i didn't have any. What is the correct way to display the printer names of the installed printers with ASP.NET? The reason being, some reports will need to be sent to specific printers, and other reports can be sent to the users preferred printer. Please provide any info about this as you can. Thanks, Michelle
  20. Hi, Thanks for the response. I have no idea what you mean, so i'll give you as much as i know. The dll is referenced through the 'references' area. The dll file that is referenced is in the component projects' bin folder. This worked in the past fine, so i'm not sure why it won't now. Especially since it actually referenced alright, because there is no build errors, it just spits a dummy when i try to use the dll to do its required functions. Pls get back to me soon with some more help! Thanks, Michelle
  21. Hi There. I had previously had a fully working application. Then, i had to reformat the server where my applications and components were housed. I restored the projects from a backup. I re-built the component, call this clsMAD, using an installed component (reinstalled it). This was working perfectly when referenced by my application, BApp1. Now; however, i have rebuilt BApp1, and there are no build errors, and all my componenets required are referenced correctly, i have even tried re-referncing them to make sure. I have the following declarations... (which worked in the past): dim sessionobj as uniobjectsLib.unioaifctrl dim madconnector as new clsMAD.MAD_Connector() However, when i now go to call cls MAD... (which worked in past): sessionobj = madconnector.mad_connect() I get the following error: "selected module not found". Why is this? I have rebuilt and rereferenced absolutely everything, and not done anything different to what i did before the server had to be reformatted. Does anyone have any ideas with what i may be able to do? Please, everyone who reads this, please offer any opinion, i need any built of help i can get! Regards, Michelle
  22. Hi There, I don't understand this one bit. I have created the crystal report from within visual studio, and i have created an aspx page that has the viewer on it, which references the report. When i build the solution, i get the following build errors: 1. Type 'ReportClass' is not defined. 2. Property 'ResourceName' cannot be declared 'Overrides' because it does not override a property in a base class. 3. Type 'Section' is not defined. 4. 'ReportDefinition' is not a member of 'QUIPS IS1.Rpt_REMSLabels_MembershipFile'. (Errors 3 and 4 are repeated numerous times) 5. 'QUIPS IS1.CachedRpt_REMSLabel_MembershipFile' must implement 'Overridable Overload Function CreateReport() as ReportDocument' for interface 'CrystalDecisions.ReportSource.ICachedReport'. 6. Type 'ReportDocument' is not defined. 7. 'CreateReport' cannot implement 'CreateReport' because there is no matching function on interface 'ICachedReport'. 8. 'Site' is not a member of 'QUIPS IS1.Rpt_REMSLabels_MembershipFile'. Now, the thing which i find most confusing about these errors, is that I have not modified this reports' class file in any way, therefore, why does vs.net create a class for the report with so many errors in it? How on earth do i fix this? I am hoping that someone may be able to offer some assistance very quickly. Regards, Michelle
  23. Hi There, Urgent query! I have remote components installed on the remote server with which i need to debug my asp.net and vb.net programs on. This has been working 100% perfect, and then, i attempted to install the full visual studio onto that server, and noted that i had to remove all the remote components. Did that, thought about it, and decided just (for the meantime) to put the remote components back on. I followed the same procedure i did when i put them on in the first place, except for now, when i go to run through the debugger with breakpoints, it doesn't stop at the breakpoints! I get no errors or anything to do with the debug, except for it doesn't actually debug??!! Please, how can i fix this problem?! Regards, Michelle :confused:
  24. The server is in-house. It's on our Intranet. Therefore, I need to set it up to be able to allow crystal to run on it, but aside from spending 2 hours installing the entire of visual studio (i'd rather not), i would like to just install whatever is required to run crystal reports on it. Any help anyone can offer with what i need to install on it?? Thanks, Michelle
×
×
  • Create New...