vb.net-2010

Model properties not set when returning to the controller for post

泄露秘密 提交于 2019-12-13 08:12:13
问题 I'm going blind staring at this. When I click save on the view, the model being sent to the save method of the controller has no values set, they're all default values. What am I missing? I'm actually using the exact same technique from another project... The data is populated just fine in my view, I can edit it and click save, the code enters the SetSiteTerms method in the controller but has none of the data from the view. :-( I know this is something simple and dumb but I just can't see it

Exporting data into Excel with multiple spreadsheets

你离开我真会死。 提交于 2019-12-13 04:28:31
问题 Has anyone successfully transferred data into Excel with multiple spreadsheets? I'm stuck with it. I'm using Visual Basic 2010. 回答1: Yes, using EPPlus. It's as simple as: Dim ws = package.Workbook.Worksheets.Add("Name") Thanks Tim :) 回答2: You can use this method to export data to excel file: Public Shared Function ExportDataTableToDataFile(ByVal srcDataTable As DataTable, ByVal dbTbName As String, _ ByVal dbFilePath As String, ByVal dbFileType As String, _ Optional ByVal schemaTable As

For me to be able to select all the row in datagridview

做~自己de王妃 提交于 2019-12-13 04:23:56
问题 For me to be able to select all rows in my datagrid and after i select all the row the next step im going to do is to save all the rows i have selected in other table through database now im using a checkbox to select all the rows i have the code for checking all the checkbox my problem is the saving to save all the rows that ive checked in just one button Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)

Resize PictureBox to match image size

女生的网名这么多〃 提交于 2019-12-13 04:08:32
问题 How to resize the Picturebox so it can show the full image if the image size is less than monitor size ! I wrote a code which can not resize (but still posting the code) ! Code before loading image on a button click Dim bmp As Bitmap bmp = New Bitmap(path) If bmp.Width < picBox.Image.Width Then picBox.Width = bmp.Width : If bmp.Height < picBox.Image.Height Then picBox.Height = bmp.Height picBox.Invalidate() : picBox.Refresh() 'picBox.SetBounds(x,y,width,height) The code does not resize the

Setting A Progress Bar Based On Directory Copy in Visual Basic

痞子三分冷 提交于 2019-12-13 04:01:38
问题 I am using Visual Studio 2010 and coding in Visual Basic. I have to display a progress bar while copying a directory. I have never worked with a progress bar before and not sure where to start. Here is the code I currently have. If My.Computer.FileSystem.DirectoryExists(filePath & "IETMS\" & installFile) Then frmWait.Show() My.Computer.FileSystem.CopyDirectory(strFileName, filePath & "IETMS", True) ListView1.Items.Clear() testReload() frmWait.Close() Else My.Computer.FileSystem

Runtime COMException Unhandeled

夙愿已清 提交于 2019-12-13 03:39:06
问题 I'm working on an app that writes to excel. The following piece f code is working properly ( it fills the requested cell) but generating a run time exception that I can't get rid of. For i = 1 To 1000 Step 1 If Not (cPart.Range("A" & i).Value = Nothing) Then If (cPart.Range("L" & i).Value = Nothing) Then cPart.Range("L" & i).Interior.ColorIndex = 3 End If i = i + 1 End If Next the exception is: COMException was unhandled :Exception from HRESULT: 0x800A01A8 any help? 回答1: That HRESULT means

Using Datazen in an iframe with external authentication

百般思念 提交于 2019-12-13 02:08:30
问题 I was able to successfully use external authentication with datazen via HTTPWEBREQUEST from code-behind with VB.NET, but I am unclear how to use this with an iframe or even a div. I'm thinking maybe the authorization cookies/token isn't following the iframe around? The datazen starts to load correctly, but then it redirects back to the login page as if it's not being authenticated. Not sure how to do that part, this stuff is pretty new to me and any help would be greatly appreciated!! Web

Calling Public Sub works in some places but not others. VB.net 2010

不羁岁月 提交于 2019-12-12 21:17:31
问题 I am having a problem calling a public sub from another form in my current form. The form that I am trying to call a public sub from is open when trying to make the call. I have used this method of calling public subs in this application, and they have always worked in the past. But now I am getting the following error... Error 1 Reference to a non-shared member requires an object reference. Here is the basic run down.... I have a main form (frmWorkOrdersMain) that is a work order system. My

INSERT permission was denied on the object 'employee_info', database 'payroll' schema dbo

一世执手 提交于 2019-12-12 10:34:58
问题 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myconnection As SqlConnection Dim mycommand As SqlCommand Dim ra As Integer myconnection = New SqlConnection("server=IAI-004;uid=;pwd=;database=payroll") myconnection.Open() mycommand = New SqlCommand("INSERT INTO employee_info([employee_id],[first_name],[last_name],[middle_name],[email],[telephone],[gender],[status],[date_birth],[hire_date]) values ('" & Employee_idTextBox.Text & "

VB.Net If statement to check if a specific image from my resources is loaded

我的未来我决定 提交于 2019-12-12 06:18:40
问题 I want to use an If statment to check if a specific image from my resources is loaded. I want to change the image when it is clicked as in: If PictureBox1.Image = My.Resources.BIKE13 Then PictureBox1.Image = My.Resources.BIKE13_Helmet End If I'm going to use several ElseIf Statements After some search I found several ways to do it but I have about 20-30 images and I'm and I need a simple method. (VS 2010) 回答1: That code cannot possibly work for two reasons. Firstly, an Image is a reference