.net - Unable To Delete Image After Opening It In App?
Jan 16, 2010
I have this code:
Dim xx as image
xx = image.fromfile(Fileloc)
picturebox.image = xx
And i can't delete the file even though I've loaded it into a picture box. If I add this line:
xx.dispose the picture box becomes a big red X. I only want to delete the images when my application is closing (they are temp files). So shall I just dispose them before I delete them?
View 1 Replies
ADVERTISEMENT
Nov 2, 2010
In VB6 you could BITBLT things around before refreshing the screen. In .NET, I'm aware of DrawImage, but that can only be done on a paint event rather than before anything gets painted. The issue I have is, I need to open several files with image data in them and then build a bigger image with those smaller images. Before I could open them, BITBLT them to a Buffer. As far as I can tell .NET offers no way to do this as the only function I've been able to find (DrawImage) only works within the paint event. Is there still a way to do this in VS08 or no?
View 6 Replies
May 15, 2012
Sub Main()
Try
Dim output, filename1, filename2, filename3, date1, date2 As String
[code]....
i'm getting the following error:
in DeleteFile The process cannot access the file'c:empfilename2.doc' because it is being used by another process.
am i supposed to release any processes before deleting the files? what am i missing?
EDIT: here is my "Send Email" function that sends out the files
Public Sub SendEmail(ByVal msgTo As String, ByVal msgBody As String, ByVal date1 As String)
Dim mail As New MailMessage()
Dim objSMTP As New SmtpClient()
[code]....
View 2 Replies
Feb 8, 2012
Dim filepathName As String = HttpContext.Current.Server.MapPath("/CaseStudyImages/" &ID & "/")
' DeleteDirContents(New IO.DirectoryInfo("filepathName"))
[Code].....
its giving me error directory is not empty how can i delete directory having files in it
View 6 Replies
Aug 7, 2011
Here is the code that I am using, every time i run it i get an error message
Error Message: Syntax error (missing operator) in query expression '(((? = 1 AND BlankP IS NULL) OR (BlankP = ?)) AND (StudentID = ?) AND ((? = 1 AND Studentame IS NULL) OR (Studentame = ?)) AND ((? = 1 AND 1t IS NULL) OR (1t = ?)) AND ((? = 1 AND 2t IS NULL) OR (2t = ?)) AND ((? = 1 AND 3t IS NULL) OR (3t = ?)) AND ((? ='.[code.....
View 2 Replies
Apr 23, 2012
When I modify and delete data in a DataGridView, I get the error:
The record cannot be deleted or changed because table 'Table Name' includes related records.
but I can add new data, only cannot modify and delete data.
View 1 Replies
Nov 29, 2010
I am trying to delete a worksheet from an Excel workbook. Here's my code snippet
objTargetSheet = objTargetBook.Worksheets(liTTemplateSheet)
objTargetSheet.Activate()
objTargetSheet.Delete()
View 4 Replies
Feb 20, 2012
why when i press the delete button the code does not delete items and if i add items the items are not added from the database.
Public Class Form1
Dim inc As Integer
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
[code]....
View 5 Replies
Oct 20, 2011
I cannot able to delete the database file. File also not in use.[code]...
View 3 Replies
Nov 28, 2011
I am trying to use a unc path to delete a folder from my own machine but I'm getting an "Authorized" error. If I change it to a non-unc path it works file.[code]....
View 3 Replies
Apr 28, 2011
I have a Listview and a button like this
Below is the code I have used for deletion of Data from Listview
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
If lvNotesList.SelectedItems.Count > 0 Then
[Code]....
View 1 Replies
Mar 13, 2012
I am displaying a Master-Detail tables in a DataGridView. The Master has only one table and the Detail also has only table. Both tables have primary keys. I would like to give the user the capability to delete one or more rows from the Master or Detail when they click on 'Delete' buttons. I am using VB.Net 2010, MS Framework 4.0 and Win 7. The database is Oracle 10g. I have written the following code but it doesn't seem to work. I keep getting 'Number of records updated: 0'.
Here is the code to delete from Job table (Master) when the user clicks on btnDelJob:
Private Sub btnDelJob_Click(sender As Object, e As System.EventArgs) Handles btnDelJob.Click
Dim i As Integer
Try
Dim response As DialogResult = MessageBox.Show("Are you sure you want to delete these rows?", "Delete row?", MessageBoxButtons.YesNo, _
[Code] .....
View 1 Replies
Jun 2, 2009
I developing a VB.net application and I'm unable to delete the record from. But my code only deletes the record from the datagridview and it is not being deleted in the database.
I'm using SQL Server Express 2008 and the table name is Admin_Table. The fields are :
Field Name Data Type
-------------- --------------
admin_ID int
admin_Name varchar
[Code]...
View 1 Replies
Mar 5, 2009
I am connected to a mdb using OleDb. The Connection code is :
' GET CONNECTED TO DB
Try' Open a connection to the database.cn = New OleDb.OleDbConnection(strConnection)cn.Open()
' Load Data Adapteradapter = New OleDb.OleDbDataAdapter(strSelect, strConnection)
' Create Auto generated Insert, Update, Delete cmds for Tableautogen = New OleDb.OleDbCommandBuilder(adapter)
[Code] .....
Add & Update are working perfectly, but delete doesn't update in the db. While application is running it shows that data is deleted, but when I run again, I see the same data, so its not physically deleting from the db. Add & Update both are working perfectly even after re-running.Can anyone tell me where am I going wrong in delete part. The row is also proeprly selected. No exceptions, yet why not deleting physically.
View 2 Replies
Jan 4, 2010
the way i have my code i grab values from my listview (dynamic integers that vary depending on user choices up to 6 long) then perform actions with them in afor loop, at the end i was trying to delete that value so the loop wouldn't use it again but i can';t seem to get the syntax to delete the value.
[code]...
i thought listviewIDs.Items.Remove(listviewIDs.Items(x).Text) would have worked but no
View 2 Replies
Jul 27, 2011
I have :
Public Class ExcelProcess
Private App As New Excel.Application
Private Books As Excel.Workbooks = App.Workbooks
[Code]....
It says Error : Expression does not produce a value. in sheet.Delete()
The Strange thing is that Microsoft API reference says that it would produce a Boolean, but it doesn't as it is a Sub and not a function.
View 2 Replies
Jun 23, 2009
I create a GridView. It has default three columsn. cant find the way to delete a colmn, i want only 1 column in it.how to do this from design view?
View 2 Replies
Feb 6, 2010
In my application, I open a "Customer Details" form and on confirming I have to delete all records from other 2 tables (Order & OrderDetails) of the database. I am not able to delete records. It somehow stops by on - ordDetAdap.Update(ordDetDs) . The code is as follows :
[Code]...
There may be N number of Orders and each order may have N number of OrderRedetails. There are rows and also shows proper data in MsgBox, also row.Delete works fine, BUT why does it stop at Update(OrdDetDs) I can't make out. Any idea where am I going wrong.
Also Is their any easy way out to delete all records using just a single statement providing OrderId from OrderDetails table ? As of there are 10 rows of a single order, then For loop will iterate 10 times and delete 10 rows, instead if I can delete all 10 rows at once would be beneficial.
View 10 Replies
May 15, 2011
I have a program which I am converting from VB6 to VB2010 this is also my first venture into sql. I have read many of the examples to try to get to grips with deleting records including those in this forum by imcilhinney
My problem is that I want to delete all but one of the records when the user presses a button, everything goes well until the 'ExecuteNonQuery' is reached.
[Code]...
View 4 Replies
Mar 11, 2010
i m using fallowing code for update, delete and save data it's working very well when i save new recored but when i update and delete recored it's showing error message "Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information."
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If thismode = 0 Then
row = ds.Tables("state").NewRow()
row.Item("state") = TextBox1.Text
[code].....
View 1 Replies
Apr 5, 2010
I ran into a problem trying to delete certain text files. 99% of the time everything works fine but every once in a while I get a problem trying to delete certain text files. The exception thrown has a lot to say so here's a screen shot of it. :
Attachment 77319
Here's the code I use to delete the text files.
If File.Exists(StringForTextFile) = True Then
Try
My.Computer.FileSystem.DeleteFile(StringForTextFile)
Catch ex As Exception
[Code] .....
I was thinking that maybe if you tried to send the file to the recycle bin it would always allow that. What would the correct code for :
My.Computer.FileSystem.SendFileToRecycleBin(StringForTextFile)
View 3 Replies
Apr 22, 2009
I'm currently patching an asp.net program where I need to be able to send an image to an SQL Server 2005 DB. It works fine when I use the asp:fileupload control, but the trick is that when the user deletes the image, I'm supposed to replace it with an image from the server saying "empty", in code-behind. I know how to open, use and save text files in vb, but I can't find any information anywhere on how to open an image / binary file in a similar manner so that I can use it as an sql-parameter on the update query. Below is an example of how easy it is to use a file from the fileupload control.
[Code]...
View 2 Replies
Jun 3, 2011
I am using MS Access 2007 as database and VB 2008 to build an application to show the content of 2 tables as a single table.I have two tables in MS Access and i have linked both the tables using "ID" as primary key(1st Table),foreign key(2nd Table). I used Query Wizard to show the data of both tables in a single table(3rd Table).I am able to view the content of all 3 tables using datagridview in vb 2008(Using Code), but i am unable to add,delete,save and search the content of the table using code. My concern is,i will be able to do all these operations using codes only.Would you please help me out in this.
View 5 Replies
Mar 27, 2011
im trying to add new images to an image list everytime a function is called. Im unable to clear the image list so im trying to create a new one each time the function executes.
Sub getActors(ByVal directory)
'Get actors and there names
Dim di As New IO.DirectoryInfo(directory)
Dim aryFi As IO.FileInfo() = di.GetFiles("*.jpg")
[code]....
how to clear an imagelist or how to implement a new imagelist
View 1 Replies
Nov 9, 2010
I am trying to load the jpg picture from the hard drive, but it is showing path is incorrect.
[Code]...
Error: Could not find a part of the path 'D:/myapp/image/balance_inq_d.jpg'. I am not sure why Bitmap putting before the D: is there any other way to do this?
View 6 Replies
Nov 21, 2010
I have a menustrimp with items on it and with each item i have added an image to it via the image property.But the problem is when ever i try to make an change to the images like i want to remove an image And replace it with another image, at run time, the old image shows the new one doesn't show.This same problem occured to some buttons with icons on them.anytime i change the icon ,it doesn't show the old one shows.It appears the changes doesn't take effect.
View 1 Replies
Aug 8, 2009
After "searching and trying" my problem is still alive.I read the topics about this problem but I can't escape from it.[code]...
View 14 Replies
Apr 28, 2012
i mean, if i have an update button for inserting images and i have got another navigator which adds information to the database, how could i delete a selected row in sql server database...In dataset, i used to remove a specific row in database by doing:
me.customersbindingsource.removecurrent()
So, this one doesn't delete anything when the image is included.
1.
[code]....
View 2 Replies
Mar 18, 2011
I have a button which when clicked, saves an image of any format from a picture box to a file.I have tried to come up with a code which can open the same file and delete any selected image but to no success.
View 6 Replies
Jun 20, 2010
I have got a listview and i added few items inside with a dustbin look-a-like image for remove item purpose. but now how do i make the user to click on the image n remove the item?i know how to remove the item with a button,but now would like to try using by image. anyone?
Here is the code i used for delete item with a button.
For Each lvItem As ListViewItem In ListView1.SelectedItems
lvItem.Remove()
[CODE]....................
View 3 Replies