2 Attachment(s)
Publishing an application to use it in an other computer
hello guys,
i'm trying to publish an application so i can use it in an other computer and i'm following the steps in this link:
https://docs.microsoft.com/en-us/dot...ots=dotnet-5-0
The problem is that the version that i get when i debug from the application visual studio and the one that it's published doesn't work exactly the same way even thought i save the changes that i make before publishing.
the difference is that when i debug the app from visual studio i get the msgbox to save the changes in the files with no probleme and the app works just fine but the version published i get the msgbox to save changes behind all the apps like in the picture (it shows behind the application) .
Attachment 182438
the problem is that my application actually shows a datagrid and because the msgbox shows behind the app i can't do anything with the datagrid because it's suppose to show in front the datagrid like this :
Attachment 182439
does anybody knows how to solve this problem and thank you sooooo much
my code is so long so i'm gonna show the most important parts :
Code:
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop
Imports System.Windows.Forms.OpenFileDialog
Imports System.Windows
Imports System.IO
Imports System.Text
Imports System.Windows.Forms.DataGridView
Imports System.Drawing
Imports System.Drawing.Color
Public Class Form1
Dim xlworkbook As Excel.Workbook
Dim ws1 As Excel.Worksheet
'Dim workbook As Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
xlApp = New Microsoft.Office.Interop.Excel.Application
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
xlworkbook = xlApp.Workbooks.Open(TextBox1.Text)
For Each xlWorkSheet In xlApp.Sheets
ComboBox1.Items.Add(xlWorkSheet.Name)
Next
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ws1 As Excel.Worksheet
work1 = xlApp.Workbooks.Open(TextBox1.Text)
ws1 = work1.Worksheets(ComboBox1.SelectedItem)
' here i change the color of some cells and add them to a data grid in Form2 and i show the form 2 when the value in the cells that i changed the color for
Form2.Show()
work1.Close()
xlApp.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) : xlApp = New Microsoft.Office.Interop.Excel.Application
System.Runtime.InteropServices.Marshal.ReleaseComObject(work1) : work1 = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws1) : ws1 = Nothing
end sub
end sub
Re: Publishing an application to use it in an other computer
Show us the code. That's never something we should have to ask for.
Re: Publishing an application to use it in an other computer
i added the code thank you for reminding me
Re: Publishing an application to use it in an other computer
Please fix the closing tag so that it formats properly.
Re: Publishing an application to use it in an other computer
Also, point out exactly where the issue is. I don't see where you're displaying a message box.
Re: Publishing an application to use it in an other computer
the message box is not created bye me it's in the savingpart where it asks me if i wanna save changes to my existing file ( so i guess it's displayed bye this part System.Runtime.InteropServices.Marshal.ReleaseComObject(work1)
Re: Publishing an application to use it in an other computer
i'm actually new to vb.net so i may be just guessing but i think that the problem is with where i'm creating or teh way i'm creating my xlApp . it's because i wanna work with my app multiple times with different worksheets. do you think that where i'm placing the creating of my xlapp is right ?
Re: Publishing an application to use it in an other computer
I think you need to set the DisplayAlerts property of the Excel application to False
Re: Publishing an application to use it in an other computer
the displayalerts is to hide the message to save the file but i still want it to show don't wanna hide it. i just don't want it to shows behind the application