Jump to content
Xtreme .Net Talk

Machaira

Avatar/Signature
  • Posts

    330
  • Joined

  • Last visited

Everything posted by Machaira

  1. Something I thought would be simple has turned out to be a little more difficult than I thought. I simply want to print a vertical line in the middle of a landscaped sheet of paper. Even hardcoding the x value doesn't seem to work when the margins change: gr.DrawLine(Pens.Black, 550, top + (lineHeight * m_CurLine), 550, e.MarginBounds.Bottom - (lineHeight * 2)) Changing the hardcoded value to: e.PageBounds.Width / 2 doesn't seem to work either. It seems the x value is relative to the left margin for some reason. Is this correct? If so, why would it be?
  2. Here's the output: System.Reflection.ReflectionTypeLoadException: One or more of the types in the assembly unable to load. at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark) at System.Reflection.Module.GetTypes() at System.Windows.Forms.Application.GetAppMainType() at System.Windows.Forms.Application.get_ProductVersion() at Requirements_Builder.AboutForm.AboutForm_Load(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  3. Has anyone had any problem with accessing this on a client machine? The app I'm working on displays this with no problem, but a client machine crashes when attempting to display it. :confused:
  4. Posted the problem to the MS newsgroups and got an answer. It appears null characters are tacked on the end of the RTF text which prevents anything from being concatenated to it. Calling the Rtf property's Replace function to replace the nulls with an empty string seems to fix it.
  5. I'm trying to use the Rtf property of a RichTextBox as a string, but I'm running into problems with concatenating it with other strings. Anything after the Rtf text is cut off. Has anyone noticed problems with this and, if so, found a fix? Attached is a simple project so you can see what I mean. Just type some text into the box and click the button. Notice the string after the Rtf text does not get printed in the Output window. rtf bug[1].zip
  6. Hmm, 3 seconds with Google - http://www.c-sharpcorner.com/Code/2002/Oct/AddIns.asp
  7. They seem to be as fast as VB6 apps after the initial firsttime startup.
  8. I have Programming VB.NET by Francesco Balena and it's pretty good. It doesn't cover some topics well enough to suit me, but it's a good starting point.
  9. Wasn't sure where else to post this, so I'll try here. :) I have found no way to create a report so that the database it uses contains no path information. I want the report to look for the database in the same folder as the report without a hard-coded path. This is using version 9 of Crystal Reports with VB.NET.
  10. Why do you think modules are bad? As for the problem I found a way around it. It means duplicating a couple of lines of code, but that's ok. What I was trying to do was have a procedure which took as a parameter a function pointer. The procedure displays a form with a datagrid. When a row in the datagrid is selected the function pointed to by the function pointer is called. The problem I was having was how to pass the function pointer to the procedure and hook it to the datagrid. I hope that explains it better.
  11. Attached is an example of what I'm trying to accomplish. Perhaps I'm going about it the wrong way. :) Any tips would be appreciated. delegates.zip
  12. The problem with the AddHandler is how to pass a pointer to the handling procedure to the procedure that actually has that code. That's where I'm caught up at. Any ideas?
  13. Hmm, that's given me an idea as to how to go about it. Thanks!
  14. Ok, hopefully this will make sense. :) I have a number of forms which call a Public procedure to display a form with a grid on it. The grid is populated with a dataset created in the procedure (via a function called from the procedure). What I want to do is pass a function pointer to a function on the form calling the procedure which will be called when the user double-clicks a row on the grid (confused yet ;)). Normally, an event handler would be set up to handle the double-click on the grid. What I can't quite figure out is passing a pointer to this event handler to the procedure and setting up the event handler in the procedure. Here's the procedure that shows the form: Public Sub ShowDataBrowser(ByVal sSQL As String, ByVal bNavigateToClickedRecord As Boolean, ByRef lClickEventHandle As Long) Dim oDataset As New DataSet() If GetDataset(sSQL, oDataset) > 0 Then Dim oBrowseForm As New DataBrowseForm(oDataset) If bNavigateToClickedRecord Then 'Add event handler for grid double-click event on DataBrowseForm End If oBrowseForm.ShowDialog() End If End Sub The last parameter in the declaration would be the function pointer to the event handler. It's declared as a Long as I don't quite know how to declare it. I've looked at Delegates and don't think they quite fit the bill here. I could be wrong however. :) Any advice would be appreciated.
  15. I was able to set the Size of a form to slightly larger than my screen res (12 pixels both ways), which is strange.
  16. I have the attached form, which I'm inheriting. On the inherited form I'm increasing the size of the form and the GroupBox2 control, then adding additional controls to the groupbox by copying a set of label and textboxes from the base form (say the Action label and associated textboxes). Upon rebuilding the project however the Document Traceability label and textbox move back to their original positions on the base form. I've dropped the base form into a new project and tried it with the same results. I don't believe there is anything wrong with the construction of the base form (although I may be mistaken). Any suggestions? Does this appear to be a bug to anyone else or am I just stupid? :D I can resize the groupbox to get the label and textbox back to their correct location,but IMO I shouldn't have to. Thanks in advance. [edit]I appear to have found a fix by making the label and textbox Public.[/edit] inherited.zip
  17. You don't need to actually run the app. Just rebuild the project and the changes will be reflected in the form that inherited the changed form.
  18. The If line is there to set the priority of the thread before entering the loop. As for the DoEvents, that was the problem. Calling DoEvents resets the cursor to the default. Thanks, though.
  19. I create a thread when my application starts which performs a query that returns a sizeable number of records. I'm running this in a separate thread to allow the user to use the features of the application that don't require this data. If the user invokes the feature that requires this data I display a message on the status bar and attempt to set the mouse cursor, as follows: Cursor.Current = Cursors.WaitCursor DirectCast(Me.ParentForm, MainForm).StatusMsg("Loading commands, please wait...", False) If tCommandListFormLoadThread.ThreadState = Threading.ThreadState.Running Then tCommandListFormLoadThread.Priority = Threading.ThreadPriority.Highest While tCommandListFormLoadThread.ThreadState = Threading.ThreadState.Running Application.DoEvents() End While End If Cursor.Current = Cursors.Default The only problem is the cursor does not change. :) Any suggestions as to why this might be occuring would be appreciated. [edit]I missed some info in the Help concerning calling DoEvents. :) [/edit]
  20. I would just use Application.StartupPath as you posted.
  21. Saw on gamedev.net that Jack has released his long-awaited DX9 tutorial. Get it from his site - http://www.directx4vb.com/
  22. If you're looking to do animation try this: Paste this into a project with Timer and Button controls: Imports System.Drawing.Image Public Class Form1 Inherits System.Windows.Forms.Form Private imgAnim As Image Private gr As Graphics Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = True End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load imgAnim = Image.FromFile(Application.StartupPath & "\explosion.bmp") gr = Me.CreateGraphics End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Static iFrame As Byte = 0 Dim rect As New Rectangle(iFrame * 65, 0, 65, 65) gr.DrawImage(imgAnim, 50, 50, rect, GraphicsUnit.Pixel) iFrame += 1 If iFrame = 6 Then iFrame = 0 End Sub End Class Place the attached graphic in the apps folder. Click the button to start the animation. If you're not doing animation the theory is still the same. Use a rectangle to get whichever sprite you want. explosion.bmp
  23. So what's the problem?
  24. Have you run a ScanDisk on your drive lately?
  25. I have one that is pretty good, but I'm looking for others. I'm not going to say which one so I don't get any biased opinions.
×
×
  • Create New...