Click here to Skip to main content
15,888,967 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionRe-Index Pin
Member 1116162530-Mar-15 1:50
Member 1116162530-Mar-15 1:50 
AnswerRe: Re-Index Pin
ZurdoDev30-Mar-15 4:44
professionalZurdoDev30-Mar-15 4:44 
Questioni have just in time debugging problem Pin
rafizan4629-Mar-15 23:01
rafizan4629-Mar-15 23:01 
QuestionRe: i have just in time debugging problem Pin
Richard MacCutchan29-Mar-15 23:10
mveRichard MacCutchan29-Mar-15 23:10 
AnswerRe: i have just in time debugging problem Pin
rafizan4629-Mar-15 23:19
rafizan4629-Mar-15 23:19 
QuestionRe: i have just in time debugging problem Pin
Richard MacCutchan29-Mar-15 23:25
mveRichard MacCutchan29-Mar-15 23:25 
AnswerRe: i have just in time debugging problem Pin
rafizan4629-Mar-15 23:28
rafizan4629-Mar-15 23:28 
GeneralRe: i have just in time debugging problem Pin
Richard Deeming30-Mar-15 2:13
mveRichard Deeming30-Mar-15 2:13 
Since you haven't bothered to tell us the line where the error occurs, I'll have to guess:
VB.NET
Private Sub TextBox11_TextChanged(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox11.Text = My.Computer.FileSystem.GetDriveInfo("D:\").TotalSize \ 1000000000 & " GB"
End Sub

Private Sub TextBox12_TextChanged(sender As Object, e As EventArgs) Handles MyBase.Load
    TextBox12.Text = My.Computer.FileSystem.GetDriveInfo("D:\").TotalFreeSpace \ 1000000000 & " GB"
End Sub

On computers with a single hard-drive, drive D: (if it exists) is typically the DVD drive. If there is no DVD in the drive, then you won't be able to read the drive's information, and you'll get a "device not ready" error. You need to check the IsReady property before trying to access the other properties:
VB.NET
Dim drive As DriveInfo = My.Computer.FileSystem.GetDriveInfo("D:\")
If drive.IsReady Then
    TextBox12.Text = drive.TotalFreeSpace \ 1000000000 & " GB"
End If

You should also give your controls meaningful names - without reading the code, it's not possible to know what TextBox11 should contain.

Also, give your methods less confusing names. At first glance, it looks like TextBox11_TextChanged will handle the TextChanged event of the TextBox11 control, which would send your code into an infinite loop.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: i have just in time debugging problem Pin
rafizan4630-Mar-15 9:17
rafizan4630-Mar-15 9:17 
Questionhow to adjust the size of drawn rectangle at runtime Pin
Member 1144146829-Mar-15 20:12
Member 1144146829-Mar-15 20:12 
AnswerRe: how to adjust the size of drawn rectangle at runtime Pin
Richard MacCutchan29-Mar-15 21:12
mveRichard MacCutchan29-Mar-15 21:12 
QuestionLooking for a thorough Iron Python tutorial. Pin
Brady Kelly24-Mar-15 23:14
Brady Kelly24-Mar-15 23:14 
AnswerRe: Looking for a thorough Iron Python tutorial. Pin
Richard MacCutchan25-Mar-15 1:59
mveRichard MacCutchan25-Mar-15 1:59 
GeneralRe: Looking for a thorough Iron Python tutorial. Pin
Brady Kelly25-Mar-15 2:05
Brady Kelly25-Mar-15 2:05 
QuestionOOPS Concepts Pin
ravitejapuladas24-Mar-15 21:35
ravitejapuladas24-Mar-15 21:35 
AnswerRe: OOPS Concepts Pin
Richard MacCutchan24-Mar-15 21:57
mveRichard MacCutchan24-Mar-15 21:57 
GeneralRe: OOPS Concepts Pin
ravitejapuladas24-Mar-15 22:01
ravitejapuladas24-Mar-15 22:01 
GeneralRe: OOPS Concepts Pin
Richard MacCutchan24-Mar-15 22:48
mveRichard MacCutchan24-Mar-15 22:48 
GeneralRe: OOPS Concepts Pin
ravitejapuladas24-Mar-15 23:45
ravitejapuladas24-Mar-15 23:45 
GeneralRe: OOPS Concepts Pin
Richard MacCutchan25-Mar-15 1:54
mveRichard MacCutchan25-Mar-15 1:54 
GeneralRe: OOPS Concepts Pin
PIEBALDconsult27-Mar-15 15:53
mvePIEBALDconsult27-Mar-15 15:53 
QuestionWhat Is Different Between WCF and Web API? Pin
Er. Pradeep Kumar Rai19-Mar-15 19:29
Er. Pradeep Kumar Rai19-Mar-15 19:29 
AnswerRe: What Is Different Between WCF and Web API? Pin
Dave Kreskowiak20-Mar-15 2:36
mveDave Kreskowiak20-Mar-15 2:36 
Generalaspx file: Operator '&' is not defined for string Pin
Member 1153636718-Mar-15 8:07
Member 1153636718-Mar-15 8:07 
GeneralRe: aspx file: Operator '&' is not defined for string Pin
Dave Kreskowiak18-Mar-15 8:13
mveDave Kreskowiak18-Mar-15 8:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.