|
For Visual Studio 2005:
My.Computer.FileSystem.RenameFile("C:\myFile.txt", "C:\myNewFileName.txt")
For Visual Studio 2003:
System.IO.File.Copy("C:\myFile.txt", "C:\myNewFileName.txt")<br />
System.IO.File.Delete("C:\myFile.txt")
Not sure what you mean about selecting the file within the filelist box. If you are using a ListBox control it all depends upon what you use as the value. Perhaps something like this:
myListBox.SelectedValue = "C:\myNewFileName.txt"
But you have to make sure that the listbox contains the value first.
|
|
|
|
|
Kschuler wrote: System.IO.File.Copy("C:\myFile.txt", "C:\myNewFileName.txt")
System.IO.File.Delete("C:\myFile.txt")
That's not very efficient. Use the Move method instead.
---
b { font-weight: normal; }
|
|
|
|
|
I knew when I was writing it that it didn't seem like very nice code, but I couldn't see a quicker way. Just brain dead I guess. Thanks!
|
|
|
|
|
Use the File.Move method or the FileInfo.MoveTo method.
---
b { font-weight: normal; }
|
|
|
|
|
How to Export a Datatable to Ms Access or SQL server
i provided the data in a datatable named t2 in a dataset named DS - how can i save this datatable in MDB format and/or in a table in sql server database.
my application is a MS-DOS DBF to Windows Converter.
|
|
|
|
|
HI
I have a problem which is I need to know if I am connected to the internet or not... how I could do this through the code
so please help me
Tamimi - Code
|
|
|
|
|
|
Use this function
Public Function IsInternetAvailable() as Boolean<br />
Dim oUrl As New System.Uri("http://www.yoursite.com/") 'Change to web address you wish to check<br />
Dim oWebRequest As System.Net.WebRequest<br />
Dim oResponse as System.Net.Response<br />
<br />
Try<br />
oResponse = oWebRequest.GetResponse<br />
oResponse.Close()<br />
oWebRequest = Nothing<br />
Return True<br />
Catch ex as Exception<br />
oResponse.Close()<br />
Finally<br />
oResponse.Close()<br />
oWebResponse = Nothing<br />
End Try<br />
End Function
Call check your connection status with
If IsInternetAvailable() Then<br />
Messagebox.Show("you are online !!!")<br />
End If
Steve Jowett
|
|
|
|
|
Hi,
I'm open serialport (COM1) and send AT command.How am I receive respond from serialport like msgbox("OK command")?
Thanks!
|
|
|
|
|
This may be simple, but I am very new to VB.net(any programming come to that), so please bear with me, while I learn
I need to ensure that a user only enters a number into a text box and not words. I can convert the contents of the text box to an integer without a problem, but the problems start, for example if the user enters the word "Seven" as opposed to the number "7".
I only want pointing in the right(!) direction, not the code
Many thanks
-- modified at 8:27 Tuesday 6th June, 2006
|
|
|
|
|
If Not IsNumeric(e.KeyChar) Then<br />
MessageBox.Show("Write Only Numbers")<br />
e.Handled = True <br />
EndIf
|
|
|
|
|
if you have MSDN installed . just paste ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref17/html/E_System_Windows_Forms_Control_KeyPress.htm into the address bar of msdn library and look at the sample code of microsoft.
|
|
|
|
|
|
Read the docs on ADO.NET, or find an article on Database access with VB.NET, or search google.
This question has been asked so many times that a little searching will get you the answer in no time.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Sir,
I want to search the substring "this is" in the string "This is a search".
Please tell the function for the same.I am using Instr Function.The problem is if the string is "this a atring" and I search for "this is" even then I get the answer that the sustring is there.Please tell the appropriate function.
Thanks and Regards
Amaneet Brar
|
|
|
|
|
dim source as string = "This is a search"<br />
dim source2 as string = "This a atring"<br />
dim search as string = "This is"<br />
<br />
Console.WriteLine(source.IndexOf(search)) ' Prints "0" as the search exists at position 0<br />
Console.WriteLine(source2.IndexOf(search)) ' Prints "-1" as the search does not exist at all
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Dear All,
Please help me, give code on how to enumerate specific type of control in form?
Thanks
lin xen mung - Indonesia
|
|
|
|
|
foreach(Control control in myForm.Controls)
{
if(control is TextBox)
{
}
else if(control is ComboBox)
{
}
}
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
-- modified at 5:49 Tuesday 6th June, 2006 (fixed typo)
|
|
|
|
|
hi ,
please help me to get the api for hardware devices connected to system in vb6. To know the status of the scanner connected to USB.
thanks in advance,
bye.
|
|
|
|
|
Hello Friends
kindly see the code VB6 code given below
Private Declare Function concat Lib "d:\StringConcat1.dll" (ByVal Text1 As String, ByVal Text2 As String) As String
Private Sub Command1_Click()
Text3.Text = concat(Text1.Text, Text2.Text)
a = Len(concat(Text1.Text, Text2.Text))
MsgBox a
End Sub
The function of the vb code is given below. The form has three text fields
a) The first text field , enter the first string
b) The second text field , enter the second string
c) The third text field, concatation of the two string i.e result of the two strings is shown in third text field
When we call "StringConcat1.dll" dll the value entered through the two text fields is send as a argument by value to the dll and concatation of the strings is done in C++ .
the dll code is given below "test.cpp"
#include <string.h>
char* __stdcall concat(char *string1 , char *string2)
{
return strcat(string1,string2);
}
the def is given "test.def"
LIBRARY StringConcat1
EXPORTS
concat @1
When I debug the code , the Concatenation is done in C++ but when the result is given to vb code ie front only the first string that is entered in the first text is shown only as the output in the third text field.
Kindly note the point:
the C++ code works perfectly.
After computation ie Concatenation , the result is not shown in the vb code
Can any help me in this matter
From Phijo Philip
|
|
|
|
|
how can i create new theme form?
................
|
|
|
|
|
How to change title bar when javascript is alert?
................
|
|
|
|
|
Hello everyone,
Given the following HTML code on a webpage:
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x1as">x1as</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4" maxlength="4"></td>
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x2a2">x2a2</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4" maxlength="4"></td>
I want to search for each x_id (which has a unique "value") and then update the value of corresponding x_val field.
Any ideas?
|
|
|
|
|
could you explain more so we can hekp you
Tamimi - Code
|
|
|
|
|
Hello,
Sorry for not giving more info.
I have a AxWebBrowser component (wb) on the form. After clicking on a button, a specific web site is loaded in wb. On this page are various
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x1as">x1as</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4"
maxlength="4"></td>
<td class="bdr_tl">
<input type="hidden" name="x_id" value="x2a2">x2a2</td>
<td class="bdr_t"><input type="text" name="x_val" value="" size="4"
maxlength="4"></td>
entries. In my program is an array that stores a new value for each x_val field for each x_id field.
I would thus like to start at the first element in the array, search for the corresponding x_id field on the web page, and update the correct x_val field with the value in the array. This continues until the end of the array.
Some of the values in the array might not have corresponding x_id fields on the current web page.
I hope this helps
Best regards
-- modified at 4:54 Wednesday 7th June, 2006
PS I am using VB .NET 2003
|
|
|
|