Replaced not worked for me


When i typed the following code the replace function does not worked can anybody tell me why is this so
Code:
dim str as string = “sample”
str.replace(“sample”,”new”)
and the resulting str value is still “sample”. It doesn’t changes to “new”.

please help if any suggestions!!!!!!!!!!!!!!!

hello friend want to tell you strings themselfves are immutable, meaning you can can’t change them. The output of the Replace method is another string. So your code will no be:

Dim result As String
result = str.Replace(“sample”,”new”)

hope this will remov ur prob…………

variable


hi forum
i tried to create a set of form fields in a loop, hence the id’s were something like: fname1, lname1, city1, fname2, lnam2, city2 etc. Now what i need is to loop through the values so that i can store them in a database.
Anyways of doing this plzz suggest!!!!!!!!!!!
Hi , use the and try the below code hope this as answer to ur prob ,this code will return a Control object that you will need to cast into whatever type control you are dealing with. If the control was not found, it will return null .
the code is as:
ParentControl.FindControl(“fname” + i.ToString())

Array as a Property


hi forum
Is it possible to use an Array as a Property!!!!!!!!!!!!!!!
if yes plzzz tell what code to use!!!!!!!!!!!!!!!!!!

thnx in adv….

hello ,yes it is posssible to use array as property use the code :
Public ReadOnly Property TheArray() As String()
Get
‘… resize and set up your array
Return YourArray
End Get
End Property

Conveting from C# to VB.NET


i am getting problem in converting a piece of code to VB.NET plz give any suggestion if possible
Code:
public partial class ViewCustomers : Page,IViewCustomerView
{
private ViewCustomerPresenter presenter;

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
presenter = new ViewCustomerPresenter(this);
this.customerDropDownList.SelectedIndexChanged += delegate
{
presenter.DisplayCustomerDetails();
};
}

}

give me help!!!!!!!!!1


Hi of the members facined this problem of converting try the below code hope this will be helpful to you:

Private presenter As New ViewCustomerPresenter(Me)

Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
presenter = New ViewCustomerPresenter(Me)
AddHandler DropDownList1.SelectedIndexChanged, AddressOf DDLSelectedIndexChangedHandler
End Sub

Protected Sub DDLSelectedIndexChangedHandler(ByVal sender As Object, ByVal e As System.EventArgs)
presenter.DisplayCustomerDetails()
End Sub

using calculator


hi forum
how can i call calculator,which available in c:windowssystem32calc.exe into my project.sow can i do this !!!!
give the suggestions

hi use the code

dim a as string
a = shell(calc.exe)

code to check file size


helo forum……
How i can check size file. Suppose, if i have some file so if the file greater than 20mb i now wanna archive the file. What the code to check the file size!!!!!!!!!!!!!!!!!!!!!!!!!

hi the code goes like this

Public Function FileSize(ByVal filepath As String) As Long
Dim fi As System.IO.FileInfo = New System.IO.FileInfo(filepath)
Return fi.Length
End Function

but remember this function return will return the size of a file in bytes.