Jump to content
Xtreme .Net Talk

msellery

Members
  • Posts

    18
  • Joined

  • Last visited

msellery's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks, but Excel.EXE is still running after that code executes. Any other possibilities?
  2. Here is a code for a button on form1: Dim Xl As New Excel.Application() Dim Xlb As Excel.Workbook = Xl.Workbooks.Open("C:\Kk.xls") Dim Xls As Excel.Worksheet = CType(Xlb.Worksheets(1), Excel.Worksheet) TextBox1.Text = Xls.Cells(1, 1).value Xls.Cells(1, 1).Value = "Something new" Xlb.Save() Xlb.Close() Xl.Workbooks.Close() Xl.Quit() When I click that, everything works as planned, but EXCEL.EXE is still a running process. The result is that you can not open Kk.xls through excel until my program is ended entirely. The problem with this is if my program crashes or ends by any other method other than the END command, Excel is still running and keeping that file in use. How do I completely shut down Excel after running the above code?
  3. Thanks for your help, but there is a new small issue. Unless I use the "End" command to terminate my program, EXCEL.EXE will still be running after I execute your code. The result is that you can not open the Excel file because Excel is in some weird "locked" state. Exiting my VB application will unlock Excel though, and everything works fine. How do I completely exit and unload Excel from memory after executing your code?
  4. Here is some sample code I've pieced together from other posts on this site. It takes a file C:\Kk.xls, puts in useful data, and saves it as anything I want. I don't need there to be a Kk file, I'd like to just create an excel file and then save it. I also don't need any dialog boxes prompting the user, so the below code is appropriate: Dim xlApp As Excel.Application Dim xlMappe As Excel.Workbook Dim xlZelle As Excel.Range xlApp = New Excel.Application() 'xlMappe = New Excel.Workbook() xlMappe = xlApp.Workbooks.Open("C:\Kk.xls") ' I don't want there to have to be Kk. I'd just like to create a new workbook, not sure how to do this. xlZelle = xlMappe.Worksheets(1).Range("A1") xlZelle.Value = "whatever data I want" Dim blah as String blah = "C:\Whatever_File_I_want.xls" xlMappe.SaveAs(blah) xlApp.Quit() xlZelle = Nothing xlMappe = Nothing xlApp = Nothing
  5. thanks for your help.. but I am new to VB (I have a better backround in Java) and I'm not sure how to do any of that in VB. If it's not difficult, could you paste code to make a custom constructor? I'm using nearly all sample code at this point, this is a learning project that I'm working on. Thanks a lot!
  6. I tried that, actually. Since Form1 is the systray icon itself kind of (it's the form with the code to load the icon and the icon's right-click menu) any time you do Dim Blah as new Form1, it's going to create new instance of it and put a second icon in the tray. Form1 is also the start-up form. Form1's OnLoad method contains code to load frmMain, my main application screen.
  7. I have two forms: Form1, and frmMain. Form1 is the sample code from VB .Net to get an icon to appear in the systray for your application. The following code is in Form1 and is used to unload the icon: Public Sub ExitSelect(ByVal sender As Object, ByVal e As System.EventArgs) 'called when the user selects the 'Exit' context menu 'hide the tray icon notifyicon.Visible = False 'close up Me.Close() End Sub My main application is frmMain. When I close main, the systray icon remains. I need to be able to call ExitSelect from frmMain. I've tried Form1.ExitSelect() but it complains about their not being an object reference.
  8. I have a windows form. I want it to do something when it's minimized. It used to be all you'd have to do is write code in the OnMinimize section. This, along with onclick, onMouseOver, etc, seem to be long gone in .Net. Where have they gone, and how can I get them back?
  9. I don't have a "Startup Object" under Common Properties. I have "Startup Project", which has two option boxes: Single Startup Proejct or Multiple Startup Projects, neither of which I need EDIT: nevermind, found it, was looking at the wrong properties list. Thanks for the help!
  10. How do you change which form loads first in .Net? I have several forms and I need to change which one loads up first. Thanks!
  11. We have a SQL expression that works perfectly except it is not ordering by anything. Here is our code: SELECT Trade.symbol, Trade.lastTrade FROM Trade WHERE (((Trade.symbol)='FSIIX')) ORDER BY Trade.lastTrade DESC; We took that directly from Access's SQL view of a query that does exactly what we want it to do (the only difference between our code and Access's is replacing the " with ' for use in VB.net) but we want to use this query from a vb .net application. It returns data just fine, but the data is not sorted. Any suggestions? Thanks!
  12. UPDATE: You know what works? Using a panel box instead of a picturebox. Panel solved my problem. Thanks again
  13. Well, I tried making a project with just that code and a button that brings up a message box. Everything that was drawn and was under the message box got erased. I'll keep messing with it I guess. Thanks for the suggestions though!
  14. Weird! Would you mind e-mailing me the project you made in full so I can run it next to my code? Please e-mail msellery@hotmail.com. Thanks a lot!
  15. Sample Code Here is the code in our Paint Method. It works, so long as nothing like a message box covers it up. If one does, everything beneath the message box is erased. Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint Dim x As Integer Dim y As Integer Dim MyGDISurface As Graphics = Me.PictureBox1.CreateGraphics Dim myWhiteBrush As New SolidBrush(Color.White) Dim myRectangle As New Rectangle(1, 1, 272, 152) Dim myPen As New Pen(Color.LightGray, 1) MyGDISurface.FillRectangle(myWhiteBrush, myRectangle) x = 0 y = 0 For x = 10 To myRectangle.Width Step 10 MyGDISurface.DrawLine(myPen, x, 1, x, 152) Next For y = 10 To myRectangle.Height Step 10 MyGDISurface.DrawLine(myPen, 1, y, 272, y) Next End Sub
×
×
  • Create New...