Properly Deleting Items From A Windows Form?
Jul 18, 2010
i am running into some difficulty with the .NET garbage collector. i have a custom control that i need to dispose and reallocate depending on user interactions. calling ctrl.dispose() and then instantiating a new control accomplishes what i want, with the nasty exception that the garbage collector (at least, i am presuming this is the GC, since this exception will happen on it's own after the application has been idle in the background for several minutes) will then periodically throw an exception: "cannot access disposed object
View 4 Replies
ADVERTISEMENT
Mar 5, 2012
OK so I did a noob screw up, I was cleaning my application and delting unused data sources and unused data bindings. Now my form is blank! All code shows up for the form and all items still show in the mainFrm.Designer.VB
View 4 Replies
Nov 27, 2009
Getting ListBox Items To Display Properly
View 2 Replies
Jan 3, 2009
I have a database(acces) with tabel questions and answers.
-->
tblquestions
questionId -> -> primary key
question -> string
[code]...
There's a combobox with questions and a listbox with questions of the chosen answer(s).I have already to add and show the questions, answers.Now I wan't to delete the answer(s) (in the listbox) of the chosen questions I have this already
con = New OleDbConnection(providerStr & dbLoc)
con.Open()
Dim command As New OleDb.OleDbCommand("DELETE FROM Answers WHERE questionId= " & 0 & " AND answer='" & lstAnswers.SelectedIndex.ToString & "')", con)
[code]...
View 1 Replies
Apr 18, 2012
My program takes a checkboxed item and depending on the serial number that is present on the item on the invoice, subtracts one from the amount list I have the following in a listview on a details page which I added with the following code:
Item - Low Socks(pink)
Serial # - 34-75-860
Price - 5.89
Amount - 12
[Code]...
Right now it doesn't look like it does anything. I have tried changing my index's on my subitems to 1 and 3 instead of 0 and 2 but i figured because they are subitems that they need to be subitem index 0 and subitem index 2 since there is one item and three subitems to that one item.
View 1 Replies
Feb 18, 2010
I'm trying to delete an item from a listbox so that it wouldn't appear when i run the program again. Is there anyway you could do this.
View 14 Replies
Apr 23, 2012
basically i had this problem before which i fixed with this code!
'REMOVE TIME
If ListBox1.SelectedIndex <> -1 Then
Dim Box As MsgBoxResult = MsgBox("Are you sure you want to remove this time?", MsgBoxStyle.YesNo)
[Code]....
It worked perfectly, all ive done to my code since is change the way the listboc is loaded / saved, it now comes from a .txt in My Documents rather than the C drive.
It now only deleted the top value of the group selected int he listbox and not all of them as it did before.
View 5 Replies
Apr 16, 2012
I have an invoice that lists several items that one person has ordered. I want to take this invoice and every time I check the item it removes one of those from another list i created called item details. I added items to this list using the item collection in the listbox.. I have invoice one that has a pink sock ordered. when i clicked this box next to it I want my total pink socks of 12 to move down to 11... the detail page and the invoice are two separate pages.
View 1 Replies
Mar 8, 2012
My VB app will not work properly on a Windows 7 64 bit PC.When I launched it on the Win7 PC it will open up OK but when I open a crystal report, the form page comes up ok but the report is missing.Then I get a pop up window asking me for a user name an PW:
[Code]...
View 9 Replies
Dec 17, 2010
I have a very basic Visual Basic Program that I created in Visual Studio 2010. It's a form application where clicking a button runs a simple calculation and then outputs the answer with MsgBox. When, I debug it works properly, however when I successfully build and run the exe, nothing happens.
View 1 Replies
Apr 9, 2009
The app Im working on is dunning on an embedded xp machine. It recieves input from the serial port from an industrial process, and then a backgroundworker class calculates and updates the single form GUI with the results from the process. Very simple.Now, the customer want to allow automatic download of log files by an USB memory. The process should work like this:
1)User plug in an usb memory
2)SHow a virtual keypad (touch screen) where the user enter a security code
3)If code ok, show a 3 choice screen, if not ok show error message and allow the user to try again.
4) If user choose the "export all" button, this choose form will close and i display another form with a progress bar that show how all files are copied to the usb memory. When this process is complete, I will display teh form that says "remove the usb memory and press ok to restart the application.
As you see here lots of forms are created and disposed based on user choices. My biggest issue here is that I have no clear design pattern to work from.For example.. should I have this "chain" in the main gui form, or should I let each form create the next form. For example on the "select action" form, when I press export, should this form create and show the "copy progress" form, or should all forms be created and destroyed from the main gui form?
Also, such an issue like with the password. I put it as a constant on the main form, to avoid "magic numbers" in the code. And then I ran into problem because the "keypad" form is created on another thread and I can't access the costant on the main form, so I got a cross thread exception.Everything starts when an USB memory is connected. And the OnConnected eventhandler is running on a different thread than the main UI thread. how to design this chain of window creation/deletion is greatly appreciated. I show all forms with the SHowDialog because I dont want the user to be able to close the form unless he/she presses a button. And not by accident press somewhere else.
View 2 Replies
Feb 21, 2011
I am making a setup application and I need to know how to properly add a registry key so the application startup with windows. I have made what you can see on the image but I get an error when my PC restarts.This setup is nothing special I just need to make the registry key properly.
View 10 Replies
Aug 3, 2010
My project requires that a windows service checks up a table on a sql database(MDF) and if product existence is 0 then sends an email to some mail address and keep checking every 24 hrs.Now Im able to send mail messages but what Im not able is to make the service itself to work or at least make sure that is working.I do the following(correct me if I do something wrong or missing a step):
1. create a new project and choose windows service
2. add a timer and set to 4000 ms just to test not wait the 24 hrs lol
3. then open its event timer_elapsed and put some code on it, like a msgbox that would keep spamming every 4 secs just to test
4. at the event onstart I enable the timer by: timer1.enabled=true
5. at the event onstop I disable the timer by: timer1.enabled=false
6. right click then choose add installer
7. in the newer installed with the two objects:
a. serviceinstaller1 set its properties to: displayname: myservice and servicename: myservice
b. serviceprocessinstaller1 set account property to LocalSystem
8. build the project and install it by opening the VS console and type: "installutil c:path blah blahservice.exe" then hit enter
9. all successfull installed open the pc manager and run the service from the list and this should be the deal
Now my real problem is that by following those steps my service is sucessfully builded, installed, and started but after the 4 seconds no msg pops up so this leads me to think that is not doing anything or I did something wrong in the steps above. Is there another way to test if this service is working else than the msgbox or the log entry? Plus, Im working on my home pc which is a xp OS. I tried the same at college pcs wich are win7 and when I did install by the console it returned an error weird but in my home pc it doesnt(and I have to present my project at college at college and tomorrow
View 7 Replies
Jan 6, 2009
right now, im using Windows Vista.. in Windows XP, deleting a file is working with this code System.IO.File.Delete("C: estdelete.jpg") But in Windows Vista, i encounter this message: Access to the path 'C: estdelete.jpg' is denied. why its happening? what is the solution for this?
View 14 Replies
Jan 10, 2011
I am busy with a project converting VS2005/2008 sln files.
I am quite far but have came acroos a problem with my source code.
I have found the files I need to change, I have changed them to the version that I need.
I now need to read the files back into my program and delete the line I have changed as it contains project numbers that are irrelevant. Then I need to save it.
I have got as far where I have searched for lines that begin with 'Project'. I have changed this also so it's now a question of reading the files in, Deleting the line with the 'Project' number and saving them.
[Code]....
View 1 Replies
Apr 20, 2010
With several forms of mine, I occasionally run into the following issue: I edit the form using the designer (Visual Studio 2008, Windows Forms, .NET 2.0, VB.NET) to add components, only to find out later that some minor adjustments were made (e.g. the form's size is suddenly changed by a few pixels), and controls get deleted. This happens silently — event-handling methods automatically have their Handles suffix removed, too, so they never get called, and there's no compiler error. I only notice much later or not at all, because I'm working on a different area in the form.
As an example, I have a form with a SplitContainer containing an Infragistics UltraListView to the left, and an UltraTabControl to the right. I added a new tab, and controls within, and they worked fine. I later on found out that the list view's scrollbar was suddenly invisible, due to its size being off, and at least one control was removed from a different tab that I hadn't been working on.
Is this a known issue with the WinForms Designer, or with Infragistics? I use version control, of course, so I can compare the changes and merge the deleted code back in, but it's a tedious process that shouldn't be necessary. Are there ways to avoid this? Is there a good reason for this to occur?
One clue is that the control that was removed may have code (such as a Load event handler) that expects to be run in run time, not design time, and may be throwing an exception. Could this cause Visual Studio to remove the control?
View 6 Replies
Aug 20, 2011
How To Make It So When You Press A Button, It Deletes Windows Temp Files.
View 1 Replies
Aug 13, 2011
I need to find a Windows forms Text edit which can handle MS Word documents correctly.That is documents with Images, textboxes etc (.doc, .docx).I have tried Devexpress Xtrarichedit and TXText Control but when you load a MS Word Document (.doc, .docx) the document does not appear as it does in MS Word.That is Textboxes overlapping images are misaligned or have no transparent background option, so the white background of the textbox hides part ot the image.Has anybody had experience with 3rd party Document .net editors which mamage MS Word Documents correctly?
View 3 Replies
Jun 22, 2010
I am looking for a code snippet which opens a image, creates a clone of this bitmap in memory disposes this opened image so that all handles are closed.
Usually we can open a bitmap using this[code...]
the following code however keeps the Image File locked until the application is running, any suggestions how to dispose it properly. (So that no handle is left open )
Things i already tried: use dispose method of bitmap <= doesnt work (need to write implementation)
Using Block also doesnt work.
View 2 Replies
Oct 8, 2011
Using VB.Net[code]...
When textbox1.focus() at that time i clicked Control + Enter key, the formid=55 is showing instead of formid=54.
View 1 Replies
Mar 30, 2010
I have a windows form with listboxes, buttons and a checkbox. It works fine at home but when I take it to school it doesn't display properly. I have been given full privileges and the .NET framework V3.5 is installed. I have all my buttons/checkboxes on the right hand side but they don't display like they aren't even there (there is no extra blank form space either). The form sized wasn't locked
View 3 Replies
Dec 19, 2009
Okay I have this two Forms.. one for the parent and one for the mdichild. I have a toolstrip menu in the parent with a button(with a pic) named close document.
View 2 Replies
Jun 7, 2011
I am trying some Uiculture change functionality.In that I need the name and text of controls in a form to change the culture.I got some Demo project and it is in C#. I tried to make the same functionality with the C#.net and Also using VB.net. But the below mentioned code returns control name with an underscore as prefix. But I don`t want underscore .Code is actually written in Class library.
code is written below
Dim fields As FieldInfo() = form.[GetType]().GetFields(BindingFlags.Instance Or BindingFlags.DeclaredOnly Or BindingFlags.NonPublic)
[code]......
View 1 Replies
Apr 22, 2009
I'm trying to figure out how to make a dynamically scaling/resizing 2d chart on a form as my 1st trip into graphics. Most 3rd party addons/DLLs are of no use to me as the bank I work for is unlikely to allow any of those to be used in my projects.
[Code]...
View 2 Replies
Oct 8, 2011
Using VB.Net (Windows Application)
In the Form, textbox, combobox etc....
-> When i open the windows form, if i press ctrl + Enter, then pop windows is opening
-> if i enter any data's in the text box, then i press ctrl + Enter, then pop windows is not opening
Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True
End Sub
[Code]....
When the form load, ctrl + Enter shortcut key is working, once i enter or select any data's in the form, then ctrl + Enter shortcut key is not working (not showing the popup windows)
View 1 Replies
Oct 1, 2011
I deleted a textbox on my login form and when I debug the startup (login) form still has the textbox that was deleted. I tried deleting the form and its components but still this form appears on start up Is. there any way that I can fix this?
View 3 Replies
Jun 20, 2012
I have spent a long time trying to find a solution for the problem I am having with comboboxes within a child form. I'm sure this must be a Microsoft error and not something I'm doing wrong..The best way to explain the problem would be to tell you what I have done so far:
If you open a new Project in VB and add two Windows Forms. Form1 will be the parent. Form2 will be the child.On Form1 add 1 x panel(Form2 will open up within the panel so make sure the panel is big enough to fit Form2) and 1 x button. The only code needed for this form is:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]...
Now run the program and click button1 to open form2 (form2 should now open within panel1).
The comboboxes and textboxes lose some of there functions for example:
1. You cant set focus on combobox without hitting drop-down
2. You cant highlight text properly in either the combobox or textbox.
3. You cant set the cursor index position using your mouse in the combobox or text box.
Does anyone know a way around this?? Mainly for the combobox as I've got some functions working for the textbox.
View 2 Replies
Jan 4, 2012
I thought Me.Close() works, but hey I'm a noob at this. Right now I'm using:
Form2.Show()
Me.Dispose()
Me.Close()
but now that I've published it, I have to pull up my task manager and do end process to actually close the app. This wasn't a problem until my office started using a public drive and everybody was using the program at once. An error popped up saying that the connection string wasn't initialized, but it worked on the computer that opened the app first. Maybe the real issue isn't properly closing the form, but that is annoying that I have to use my task manager to close my app.
View 6 Replies
Jul 31, 2009
This problem seams to be in other forms without any concrete solutions. I figured id post it here since i am running into the same problem and i am sure you have at well at some point (if not then you will soon...lol). The problem is this error is appearing when i open a form in designer mode.
[Code]....
View 2 Replies
Nov 25, 2009
I have created a calendar in VB which works fine when set to the startup form, but when I use the MdiParent form as the startup form and try to display the calendar by use of a control it just shows all the buttons and labels with no values assigned to them. Its almost as if the Calendar_Load event is not working, or not accessing the methods in my CalendarClass.
View 2 Replies