|
Microsoft Word can already do this for you.
Just go to Tools\Options on the menu, select the Save tab, and check "Allow background saves" and "Save AutoRecovery info".
|
|
|
|
|
Hi every body.
I have some problem using date while changing My.Application.culture.
let we say that the regional setting have the date MM/dd/yyyy, and My.Application.Culture have the date dd/MM/yyyy, so any parsing from string to date or from date to string will reverse day and month.
in my project I have a combobox that was be filled using some date from a database. while filling it, all date was converted automatically from MM/dd/yyyy to dd/MM/yyyy. when I choose an item and I click on my button, I use CDate(combobox1.text) because I will call a function that need a date parameter: Sub New(ByVal SchoolId As Integer, ByVal YearStartDate As Date)
the cdate return the string to MM/dd/yyyy, so YearStartDate will be in MM/dd/yyyy format. i
n the sub New, I will search the date in a database , I use a command:
Dim command As New OleDb.OleDbCommand( _
"SELECT tYears.* FROM tYears WHERE tYears.YearStartDate = #" & YearStartDate & "# AND tYears.SchoolId=" & SchoolId _
, cn)
in this command the date will be reformatted in MM/dd/yyyy so it was reversed....
example:
1-the date in the first database is 10/05/2005 with MM/dd/yyyy format as same as regional setting.
2-it will appear 05/10/2005 in the combobox because my culture have the dd/MM/yyyy format.
3-when I use CDate it makes it 10/05/2005
4-when I use the Select command the string make it 05/10/2005, so I will search 05/10/2005 that will be never found!!!!!!!!!!!!!!!!!!
what is the solution?????????????????????//
thanks
OmarMallat
|
|
|
|
|
May I found the solution, but how can I get and set the regional setting date format from my application????
OmarMallat
|
|
|
|
|
You can get the current regional setting's date format via...
Application.CurrentCulture.DateTimeFormat.ShortDatePattern
Setting the date format is another matter. The above property is read-only, so the only way to change the date format just for your application is to overwrite your app's current CultureInfo.
Dim info As System.Globalization.CultureInfo<br />
info = System.Globalization.CultureInfo.CurrentCulture<br />
info = New System.Globalization.CultureInfo(info.LCID, True)<br />
info.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy"<br />
System.Threading.Thread.CurrentThread.CurrentCulture = info
|
|
|
|
|
I know how to change a culture and read the date format for a culture, but I want to read the and set the date format of the windows, like if I go to Regional and languages control and change it...
Don't worry and thank you very much, but can you help me. I think that I can do a same thing using API (GetLocalInfo, SetLocalInfo), but still searching....
OmarMallat
|
|
|
|
|
Hi all,
anyone knows if can convert a pdf page to image?
if so, where can i find examples? or anybody can tell me how.
thanks, an happy Xmas from Spain...
|
|
|
|
|
I have a web page, where after the users enters the data, they should be able to go back and modify data on all the pages. I am using ASP and VBSCript. I am using session variables and getting all the data, into the controls for modifying, but there is a page, which it has a radio button "yes" and "no", if you click yes, it shows more controls.
now, my question is when they come back to modify data and if the session values is yes, it is checked yes, but how shall I show the other controls without clicking on the radio buttons, or how to call the click event within the VBScript.
I need to call the "show('hideable1') method from VBScript if, the session value is yes....
Thanx,
abhi
example code....
onClick="show('hideable1')" name="radio_aspiration" value="yes" '<%if Session("rdaspiration") = "yes" then %>' checked '<%end if%>'> yes
' checked '<%end if%>'> no
abhi
|
|
|
|
|
I would do something like this:
<script>
window.onload = LoadDefaults(<% Session("rdaspiration") %>);
</script>
<script>
function LoadDefaults(rdaspiration)
{
if (rdaspiration == "yes" ) { show("hideable1") }
else {show("hideable2") }
}
</script>
I think something like that should work. I didn't try it in a browser so the syntax may not be correct but the general idea should work.
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
I wantto override Textbox class for date entry.
Format is gg.mm.yyyy
I wrote code below, but user enters 3. number for month, cursor goes to begining of the date.
what do u offer me. (I CANT USE MASKEDTEXTBOX, because clients use Windows ME)
Private Sub DateTimeExtended_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress<br />
Dim asciiInteger As Integer = Asc(e.KeyChar)<br />
Select Case asciiInteger<br />
Case 48 To 57 'Sayi<br />
select case me.text.length<br />
case 2: me.text &= "."<br />
case 5: me.text &= "."<br />
end select<br />
e.Handled = False<br />
Case 8 'Backspace<br />
e.Handled = False<br />
Case Else<br />
e.Handled = True<br />
End Select<br />
End Sub
|
|
|
|
|
You need to set the cursor back to the end of the string. You can do that with the following line:
DateTimeExtended.SelectionStart = me.text.length
However, this would still cause problems, for instance, if the length is 5, and you go back and change character 2. You need more length checking. Try the following code:
Private Sub DateTimeExtended_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress<br />
Dim asciiInteger As Integer = Asc(e.KeyChar)<br />
Dim currentPosition As Integer<br />
Select Case asciiInteger<br />
Case 48 To 57 'Sayi<br />
currentPosition = Me.SelectionStart<br />
If currentPosition = Me.Text.Length Then<br />
Select Case Me.Text.Length<br />
Case 2<br />
Me.Text &= "."<br />
currentPosition = currentPosition + 1<br />
Case 5<br />
Me.Text &= "."<br />
currentPosition = currentPosition + 1<br />
End Select<br />
End If<br />
Me.SelectionStart = currentPosition<br />
e.Handled = False<br />
Case 8 'Backspace<br />
e.Handled = False<br />
Case Else<br />
e.Handled = True<br />
End Select<br />
e.Handled = False<br />
Case 8 'Backspace<br />
e.Handled = False<br />
Case Else<br />
e.Handled = True<br />
End Select<br />
End Sub
Roy.
|
|
|
|
|
Please note that this still doesn't format dates if you are pasting data into the control.
The more conditions you try to cover, the more complex your code will be.
Good luck.
Roy.
|
|
|
|
|
Instead of trying to anticipate all possible keystrokes that the user may press in the date textbox, I prefer to wait until the user is done and presses OK before validating the date. I let the user enter whatever they want and then edit the complete textbox contents. Here are two generic date textbox tests that I normally apply in my data editing procedure.
'** A date is required
If txtDate.TextLength <= 0 Then
MsgBox("A date is required")
txtDate.Focus()
Exit Sub
End If
'** The date must be a valid date
If IsDate(txtDate.Text) Then
'** Ensure the date is complete and properly formatted
txtDate.Text = CDate(txtDate.Text).ToShortDateString
Else
MsgBox("The date is not valid")
txtDate.Focus()
Exit Sub
End If
Another advantage of this code is that it uses the Windows region settings, so you don't have to be concerned with formatting the date correctly for the user.
Do or not do. There is no try.
|
|
|
|
|
I want to know how can i check whether certain key value exist in registry while using Visual Studio 2003 IDE for a Setup Wizard.
I want to do this programmatically.
Regards,
Asim
|
|
|
|
|
Imports Microsoft.Win32
Public Function ReadRegKeyValue(ByVal KeyName As String, _
ByVal ValueName As String) As String
' Read the value of an existing registry key
' Pass: KeyName Name or path of the registry key for which the
' value is being read
' Return: String The sub key value (zero length string if the
' sub key does not exist)
' Create an instance of the RegistryKey class from the Microsoft.Win32 namespace
Dim RegObject As RegistryKey
Dim RegKeyValue As String
' Retrieve the sub key value
Try
RegObject = Registry.LocalMachine.OpenSubKey(KeyName, False)
RegKeyValue = CType(RegObject.GetValue(ValueName, ""), String)
RegObject.Close()
Catch
RegKeyValue = ""
End Try
Return RegKeyValue
End Function
Do or not do. There is no try.
|
|
|
|
|
If you are doing this in a custom action, then I recommend the previous poster's answer.
If you are doing this to check for the existence of a key and want to know its value, then perform the following steps:
- Right click on your setup project in the Solution Explorer
- Choose View > Launch Conditions from the context menu
- Right click on "Search Target Machine" in the Launch Conditions window
- Choose "Add Registry Search"
- Name the new item and fill out its properties in the Properties viewer
Now that property that you've created for the value of the registry key will hold the value that you sought.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you Curtis.
Yes, this is what i was interested in.
The other post was just about registry action using vb.net and not about what i asked!
Regards,
Asim
|
|
|
|
|
Asim,
Glad to help. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I used to use ConnectNetworkDrive in VB6. Is there a way to do that in VB.NET?
TIA
|
|
|
|
|
ConnectNetworkDrive is not part of VB6, not is it a function in the Win32 API. Where did this function come from? If you can get that code, you can translate it to equivilent code in VB.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hellow t all ..
i am trying to clean a combobox from the selection ,
i use the combobox.selectedvalue = -1
it clear the combobox but still return to me the selectedvalue as -1
thx for anyhelp
|
|
|
|
|
try to use combobox.selectedindex = -1 instead of combobox.selectedvalue = -1
Thats it. If it don't clear then use the same twice!
Regards,
Asim
|
|
|
|
|
i had tryied it it wont work !
selectedindex - 1 pick the item befor the one that i had picked
|
|
|
|
|
I said : combobox.selectedindex = -1 and not combobox.selectedindex -1 !
Try the above thing and it would work!
Regards,
Asim
|
|
|
|
|
Hi,
I need some help. How can I verify if an object has no instance.
I need to know if my object is nothing, to prevent the object null reference exception.
Thanks in advanced.
biglewy
|
|
|
|
|
try to use :
if not OBJECT is nothing then
// Code here...
end if
Regards,
Asim
|
|
|
|