|
Excellent answer.
The more anger towards the past you carry in your heart, the less capable you are of loving in the present.
My Blog![ ^]
|
|
|
|
|
Hi, I am trying to bind data to a combo box but it is not coming. I have two tables one for student and another for gender. The gender table has GenderID As a primary key. The values for GenderID are 1, 2, and for Gender are Male and Female. The Student table has gender which is a foreign key to table gender. I I have designed a form with gender which is a combo box. I want when I click gender on student form, I am able to pick the values in Male and Female in the drop down. I have tried using the datatable adapter but when i click the items in the list, the form freeses.
What could be wrong?
|
|
|
|
|
this example is taken from this article Database Binding a combobox[^]
ComboBox1.DataSource = objDataTable
ComboBox1.DisplayMember = "FirstName"
ComboBox1.ValueMember = "ID"
Nagy Vilmos wrote: And eat bacon. Bacon's real important for 'puters.
|
|
|
|
|
Hi All,
I have written a code to check whether the 'Removable' or 'CDRom' is ready or not.
Below is the code .
But while executing the code ,for the 'removable' its working fine means "Removable disk is ready".
When coming to CDRom its showing that "Disk is not ready" even though i have a blank CD in my Cd Drive.
loDrive.IsReady returning false for "blank CD"
loDrive.IsReady returning true for "Already data contained CD",But this is not needed in my case.
Dim loFileSystem As FileSystemObject
Dim loDrive As drive
Set loFileSystem = New FileSystemObject
For Each loDrive In loFileSystem.Drives
If loDrive.drivetype = Removable Or loDrive.drivetype = CDRom Then
If loDrive.IsReady = True Then
If loDrive.FreeSpace = 0 Then
MsgBox "There is no free space"
End If
If loDrive.FreeSpace > 1457664 Then
MsgBox "Space more then 1457664"
WriteToCDDVD ("C:\testdir\test2.txt")
End If
End If
End If
Next
Please help me in this.
|
|
|
|
|
The FileSystemObject isn't going to work for you. If will only return IsReady=Ture if there is a mounted filesystem on the disk. Since the CD is blank, there's no filesystem, hence, not ready.
You would have to use the IMAPI API[^] to do what you want.
|
|
|
|
|
What happens if you have no CD in the drive?
Nagy Vilmos wrote: And eat bacon. Bacon's real important for 'puters.
|
|
|
|
|
I have a single-thread project that's been working fine until tonight. Everything goes well until I try to close it. No error msg, it doesn't freeze. But it won't close. In VS I have to hit the Stop Debugging button. If I run it from a shortcut, I have to use Task Manager to close it (and I get a Not Responding msg).
The only changes I've made tonight was to add a tab control, one page with a WebBrowser and one with a ScintillaNet control. The ScintillaNet control was already in use and I simply moved it to a tabpage. I undid all this but the problem still exists. Closed and restarted VS and that didn't help. Commented out everything in the FormClosing sub - no effect. Other projects close without issue.
Suggestions?
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
Open Task Manager and watch CPU load. Either your app is in an eternal loop (total CPU load = 100% divided by number of cores), or it is deadlocked (two threads waiting for a resource/lock the other is holding).
BTW: are you absolutely sure your app is single-threaded? that requires you don't use any callbacks, no timers, no asynchronous operations, no ...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: Open Task Manager and watch CPU load. Either your app is in an eternal loop (total CPU load = 100% divided by number of cores), or it is deadlocked (two threads waiting for a resource/lock the other is holding).
CPU load stays at 4 to 8 percent.
Luc Pattyn wrote: BTW: are you absolutely sure your app is single-threaded? that requires you don't use any callbacks, no timers, no asynchronous operations, no ...
None of that stuff. I just wanted a super-simple PHP/HTML editor. Just opens, edits and saves php/html files.
It's just a temp workaround, but I added Me.Dispose at the end of the Me.Close sub and it closes without issue. That of course doesn't explain (at least not to me) why it suddenly quit closing properly. I removed this before looking at the cpu load, btw.
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
Alan Burkhart wrote: CPU load stays at 4 to 8 percent.
Not a busy loop then.
Sounds strange.
Where are Me.Close and Me.Dispose located in your source? in some event handler?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: Where are Me.Close and Me.Dispose located in your source? in some event handler?
The "Exit" menu item's click event:
Private Sub CloseApp() Handles menuFile_Exit.Click
Try
Me.Close()
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation, title)
End Try
End Sub
I added Me.Dispose to the end of the FormClosing event handler. Too much code to list here, but all FormClosing does is save preferences, recently used docs and open tabs. Nothing complicated. I disabled (commented) all the code in the FormClosing sub to see if something there was causing the problem. No change.
Weird, huh?
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
weird indeed.
Here is some info you probably already know, and some suggestions:
- Closing and Closed events are obsolete, use FormClosing and FormClosed instead;
- there could be more than one handler associated with form closing;
- if form disposing at the end of FormClosing solves the problem, seems like something goes wrong inside FormClosed handler;
- you could consider calling Application.Exit() instead of Me.Close()
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Tried Application.Exit() but it didn't change anything.
I'm using FormClosing , but not FormClosed .
Only one eventhandler for FormClosing .
I gotta get off of here for tonight. Early start / long day tomorrow. I'll work on it again tomorrow. As always, thanks for your help.
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
New ideas:
1.
any chance the ScintillaNet creates a non-background thread? does it offer methods to terminate itself, a close/dispose/whatever? if so, consider calling them in FormClosing.
2.
the change you introduced by moving the ScintillaNet from your Form to a TabPage could be this: on the Form it starts in a visible state, on any non-first TabPage it initially is invisible, therefore it might work a little differently. Experiment: change the order of the TabPages, so ScintillaNet is visible right away.
If #1 does not help and #2 does, time to contact the ScintillaNet provider.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: any chance the ScintillaNet creates a non-background thread? does it offer methods to terminate itself, a close/dispose/whatever? if so, consider calling them in FormClosing.
Never needed to do this before but tried it nonetheless. Didn't help. I disposed each ScintillaNet object individually.
Luc Pattyn wrote: the change you introduced by moving the ScintillaNet from your Form to a TabPage could be this: on the Form it starts in a visible state, on any non-first TabPage it initially is invisible, therefore it might work a little differently. Experiment: change the order of the TabPages, so ScintillaNet is visible right away.
The ScintillaNet control is on the first tabpage. I also removed the new tabcontrol so that the program was like it was before the problem appeared (ScintillaNet docked in the form). No change.
I've been using ScintillaNet in place of a TextBox for a couple of years and never encountered this before. I've swapped the StartUp form to a couple of others and they close fine. I may try creating a new form and piece meal the existing code onto it to see if I can track down the cause. Who knows? It may be that the form itself is corrupt.
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
Sounds like a plan.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I finally gave up and created a new project. Copied the controls and code from the offending form to the new project one block at a time, looking for the cause. It never materialized. New project works fine. I may never know what caused it. I'm going to just let this one go.
Thanks for trying. This one was just too weird to keep chasing.
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
Well done. Trying to understand and fix is excellent, stepping over it when normal measures don't work is quite acceptable.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
You may want to use WinMerge to compare the differences between your old and new project. Who knows, maybe something will stick out.
|
|
|
|
|
I was just going to point out that using a SCM would have helped diff'ing this as well. Or rolling back to last known good state...
Andreas
|
|
|
|
|
Your own idea of recreating the form and adding control by control and code block by code block is one I have used successfully.
Never mind who, where is John Galt when we need him?
|
|
|
|
|
Oakman wrote: Your own idea of recreating the form and adding control by control and code block by code block is one I have used successfully.
Yep, I'm about to get into that very thing. I can't find one thing wrong with the existing form and I'm wondering if the file is corrupt down in some level I cannot access.
If Barney Frank eats a fruitcake, is it cannibalism?
|
|
|
|
|
Alan Burkhart wrote: in some level I cannot access
you may have discovered some anti-Higgs particles in the bits of your Form...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Using C# in Visual Studio 2005 I have had this problem using databound controls.
If the user enters a value in a databound textbox that expects a value, then deletes the value, the program will not allow the user to leave the textbox, even to exit the program.
You cannot do anything except re-enter a value.
Dennis
|
|
|
|
|
Barney Frank is one of the few decent, intelligent people we have in congress.
|
|
|
|