|
Partitions are not accessible using standard methods and controls. DriveBox won't see them. Partitions contain Volumes, the type of which is determined by the file system that created the volume. DriveBox WILL see volumes if they are valid and assigned a drive letter.
Since none of the standard file methods will work on hidden volumes and partitions, you'll have to write all of the low-level code to parse and interpret the volumes in these partitions. NOT a fun job...
Your better option is to use a Partition Management (like Partition Magic) utility to remove the hidden attribute from the partitions so you can then see the volumes (if any!) on them and use the standard File I/O methods to access them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
Im trying to get fields from a database to show in a combo box. I am able to do this through the wizard, but would prefer to do it manually. this is what I've done so far, but obviously it doesnt work, was just hoping someone could tell me where im going wrong.
ComboBox2.Text = dataSet.Tables("Requirement").Rows(inc).Item("RequirementType")
ComboBox2.Text = dataSet.Tables("Requirement").Rows(2).Item("RequirementType")
This obviously doesnt work! (only shows ONE field)
Also is there a way to manually make a list of things you want to put into the combo box?
Thanks in advance
Jaidev
|
|
|
|
|
ComboBox2.DataSource = dataset.Tables("Requirement")
ComboBox2.DisplayMember = "RequirementType"
ComboBox2.DataBind()
something like that
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How i add new item to combo box during runtime ? for example , i want add new "Please select" as first item to display with it's value -1 ?
Best regards,
Chee ken
|
|
|
|
|
hi guys
i need to put multi forms in a main form
i want to make the application in one main form
and on clicking buttons i change forms included in the main one
for more info plz see this picture that explaine
http://img478.imageshack.us/img478/5970/multiformhp8.jpg[^]
i'm using vb.net 2003
|
|
|
|
|
Create your multiple 'forms' as controls, put them on your form, and show/hide them as needed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Use the WindowsControllibrary project or right click on your existing project select add then add new item then select usercontrol.
|
|
|
|
|
I am working on a Datagrid in ASP.Net using VB. The datagrid is linked to an SQL Server database and uses the EditCommandColumn for editing. The issue that I am running into is that the client for the web application wants to use one datagrid to edit two different types of invoices. This causes an issue because certain fields on one invoice can be edited while the other invoice only allows one field to be edited. I need to have a way to set and unset the Readonly property for my BoundColumns based on the type of invoice it is. Is there someway to set the correct Readonly property for each column when the user clicks on Edit? I would appreciate any ideas or suggestions on the best way to do this. Thank you in advance.
|
|
|
|
|
may be custom code!! like instead of using the predefined edit link you create something like edit1 and write your logic accordingly!!!
Gautham
|
|
|
|
|
I've got a bound DataGridView that performs some validation exactly as I want it to - providing I don't have the columns formatted.
A code snippet example of the validation that works when I don't format the columns is:
<br />
If CType(e.ProposedValue, Integer) <= intPreviousToValue Then<br />
e.Row.RowError = "Error message"<br />
e.Row.SetColumnError(e.Column, "Error message")<br />
End If<br />
Using the standard VB.NET 2005 Express formatting properties, the columns are formatted to be:
Column 0 - Numeric - no decimals
Column 1 - Numeric - no decimals
Column 2 - Currency - two decimals
If I take the formatting out, the grid validation works fine - if I put the formatting back in, I can't get the validation to work.
What am I breaking by putting the formatting in?
|
|
|
|
|
Anybody got any thoughts on this?
One thing I forgot to say is that if I put a msgbox in place, when the conditions are met, it show the message - its just the errorprovider notification icon that I can't get.
|
|
|
|
|
Hi all,
i have been trying to create some function that take the Decimal datatype to convert decimal to hexadecimal and the reverse.
my code at present uses the long datatype which go up to 9.2 E+18. Currently i am working with larger numbers.
This is my code:
Private Function ConvertDecimalToHexadecimal(ByVal number As Decimal)<br />
Dim converted As String<br />
Dim value As Long = Long.Parse(number)<br />
converted = value.ToString("X")<br />
Return converted<br />
End Function
Private Function ConvertHexadecimalToDecimal(ByVal number As String)<br />
<br />
Dim txt As String<br />
Dim value As Decimal<br />
Dim converted As String<br />
<br />
txt = UCase(Trim(number))<br />
If txt.StartsWith("&H") Then txt = txt.Substring(2)<br />
value = long.Parse(txt, Globalization.NumberStyles.HexNumber)<br />
converted = value.ToString()<br />
Return converted<br />
<br />
End Function
Is there some way of making this work for numbers up to the decimal datatype of 1.79 E+308
or if anyone knows of another way?
Thanks
|
|
|
|
|
Hi,
According to Microsoft's .NET documentation, you'll have to either use the Double type instead of Long or round you numbers to a more manageable size, before handling them.
On a less helpful note, you could make your function a little smaller like so:
<br />
Private Function ConvertDecimalToHexadecimal(ByVal number As Decimal) As String<br />
Return Double.Parse(number).ToString("X")<br />
End Function<br />
<br />
Private Function ConvertHexadecimalToDecimal(ByVal number As String) As String<br />
If UCase(Trim(number)).StartsWith("&H") Then number = number.Substring(2)<br />
Return Double.Parse(number, Globalization.NumberStyles.HexNumber).ToString<br />
End Function<br />
Hope it helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I couldn't find any built in functions to do such large conversions. However, I had some code to convert Hex to Dec and vice versa. I made some modifications to ensure the conversion would work with the largest decimal number allowed. Here is the code which I believe works perfectly. If you discover a problem let me know. Hope this helps.
Public Class Form1
'Test conversion of the largest allowed decimal value
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim msg As String = "MaxDecimal: " & Decimal.MaxValue.ToString & _
vbCrLf & "MaxDecimal as Hex: " & DecToHex(Decimal.MaxValue).ToUpper & _
vbCrLf & "Hex converted back: " & HexToDec(DecToHex(Decimal.MaxValue)).ToString
MsgBox(msg)
End Sub
'---MAIN CONVERSION FUNCTIONS---
'Converts a decimal type to it's Hex value
'Does not support fractional numbers, so don't pass them :)
'Actually they just get rounded so nothing to worry about.
Private Function DecToHex(ByVal number As Decimal) As String
number = Decimal.Round(number)
Dim result As New System.Text.StringBuilder
Do While number > 0
Dim remainder As Integer = number Mod 16
number = number / 16D
number = Decimal.Truncate(number)
result.Insert(0, DecToHexChar(remainder))
Loop
Return result.ToString
End Function
'Converts a string of Hex characters to it's decimal equivalent
'Does not provide any validation. String must have nothing but
'valid Hex values. Although no errors should occur.
Private Function HexToDec(ByVal hex As String) As Decimal
Dim result As Decimal
For i As Decimal = 0 To hex.Length - 1
Dim chr As Char = hex.Chars(i)
result += (HexCharToDec(chr) * Pow(16, hex.Length - 1 - i))
Next
Return result
End Function
'---HELPER FUNCTIONS---
'Converts a Decimal value 0 to 15 to it's Hex character equivalent
'If number is anything else it returns String.Empty
Private Function DecToHexChar(ByVal number As Integer) As String
If number < 10 Then Return number
Select Case number
Case 10 : Return "A"
Case 11 : Return "B"
Case 12 : Return "C"
Case 13 : Return "D"
Case 14 : Return "E"
Case 15 : Return "F"
End Select
Return String.Empty
End Function
'Converts a Hex character to it's decimal equivalent
'Valid characters: 0-9, A-F
'Returns -1 if invalid
Private Function HexCharToDec(ByVal chr As Char) As Decimal
If Char.IsDigit(chr) Then Return Decimal.Parse(chr)
Select Case Char.ToUpper(chr)
Case "A" : Return 10D
Case "B" : Return 11D
Case "C" : Return 12D
Case "D" : Return 13D
Case "E" : Return 14D
Case "F" : Return 15D
End Select
Return -1D
End Function
'Raises a number to a given power
'Math.Pow and ^ were not options because they don't handle up to decimal
Private Function Pow(ByVal number As Decimal, ByVal exponent As Integer) As Decimal
Dim result As Decimal = 1
For i As Integer = 1 To exponent
result *= number
Next
Return result
End Function
End Class
-- modified at 22:38 Friday 9th February, 2007
|
|
|
|
|
Is there a VB.Net way to enumerate objects in a program running as a free standing exe?
RCarey
|
|
|
|
|
A program that's running, and is not your program ? No.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
My program. I want to click a debug menu item and get a list of objects that exist at that time. Ditto for threads.
RCarey
|
|
|
|
|
OK, you can do that with reflecton. You can reflect over your objects and get out variable names and values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I run Win XP sp2 and want to monitor a server. I have searched the web left to right, but I cannot find out how I retrive information about the chassis temperature or what workgroup a server is in.
There are plenty of examples showing how to display the computer name for example Private Declare Function GetComputerName Lib "kernel32".
I though I could use WMI to find the temperature. Does anybody have a small code sample?
To find the workgroup I read something about netapi32. But it seems very complex. Surely there must be an easy way to check the name of the net workgroup a computer is in.
As you can understand, I am a VBA novice .
Help greatly appreciated.
|
|
|
|
|
How to dissallow the user to open an opened form
I mean dont allow to create many instance of the same form
(if form is open dont open it again
Regards
Ramy
|
|
|
|
|
Goto the "Project->Project Properties->Application" menu in VS, and then click the "Make single instance application" check box.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
i checked it
but more then one instance are still running
note i am using the following
dim fr as new form1<br />
fr.show()
do u think is there a problem with the above code?
anything should be added to it
Regards
Ramy
|
|
|
|
|
try this, but i havent test it.
dim fr as form1
if fr is nothing then
fr = new form1
end if
fr.show()
|
|
|
|
|
Creating a single instance application just prevents an application from being run more then once. It doesn't prevent a form from being created multiple times. I believe the appropriate way to create a single instance form is the following.
Public Class Form2
Private Shared m_Singleton As Form2 'Current instance
'Declared private so a new instance can't be created directly
Private Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
'Gets the current instance of the form or passes back a new one
Shared ReadOnly Property Instance() As Form2
Get
If m_Singleton Is Nothing OrElse _
m_Singleton.IsDisposed OrElse _
m_Singleton.Disposing Then m_Singleton = New Form2
Return m_Singleton
End Get
End Property
End Class However, if this is your main form you may need to make a small tweak. The code that gets generated to load your form won't used the shared property Instance. If you get an error and can't figure it out let me know. All I did was double clicked the error and then changed the line it brought me to so that it used the Instance property.
|
|
|
|