Guys I am having this error mess.


Warning 1 sub 'Page_Load' shadows an overloadable member declared in the base class '_Default'. If you want to overload the base method, this method must be declared 'Overloads'. C:\Desktop\Vb 9.0\experimental_asp\experimental_asp\Default.aspx 6 9 experimental_asp

I was just following the tutorial from w3Schools, and I really don't know how to handle this,

anyone please help

Post your code-behind code so that we can try to help.

Oh yes, of course, this is my code;

If ListBox1.Items.Count = 0 Or ListBox1.SelectedIndex = -1 Then
MsgBox("No item selected!", MsgBoxStyle.Exclamation, "Dean")
Else
FolderBrowserDialog1.ShowDialog()
Dim filetoMove As New IO.FileInfo(ToolStripStatusLabel3.Text & "\" & ListBox1.SelectedItem.ToString)
filetoMove.MoveTo(FolderBrowserDialog1.SelectedPath.ToString & "\" & filetoMove.Name) 'I think the error occured here
MsgBox("File: " & filetoMove.Name & "; moved to " & FolderBrowserDialog1.SelectedPath.ToString, MsgBoxStyle.OkOnly, "Dean")
ListBox1.Items.Remove(ListBox1.SelectedItem)
ToolStripStatusLabel1.Text = ""
ToolStripStatusLabel2.Text = ""
ToolStripStatusLabel4.Text = "[" & ListBox1.Items.Count & "]"
ToolStripStatusLabel5.Text = "Current Index: none"
End If

I am using this code to move a selected file from folder to another. The JIT error says, that moving is not granted because the program doesn't have access to the folder...

Oh, my mistake! The above is not the code I am supposed to post, it's this one


<script runat = "server" >
Sub page_load() --The error is here. The Page_Load event is in green underline
If Not Page.IsPostBack Then
Dim MyCountries = New ArrayList
MyCountries.Add("Italy")
MyCountries.Add("Turkey")
MyCountries.Add("Greece")
MyCountries.Add("Ukraine")
MyCountries.Add("Malta")
MyCountries.TrimToSize()
MyCountries.Sort()
rb.DataSource = MyCountries
rb.DataBind()
End If
End Sub

Sub changed(ByVal Source As Object, ByVal e As EventArgs)
lbl1.Text = rb.SelectedItem.ToString
End Sub
</script>


I was just following the code I got from W3Schools,

So you're just trying to move a file from one folder to another?

Why not use the overloaded

File.Move()

method?
It takes two parameters, the source path, and the destination path.

Also

FileInfo.FullName

returns the full path to the object it represents.

Hope this helps, and please make use of the code tags, they help format your code so it's more easily readable on here.

I think you haven't read the first line on my last post, I said I had a mistake...
I was not supposed to post that file moving program, it's the latter post... I'll just repost it;


<script runat = "server" >
Sub page_load() --The error is here. The Page_Load event is in green underline
If Not Page.IsPostBack Then
Dim MyCountries = New ArrayList
MyCountries.Add("Italy")
MyCountries.Add("Turkey")
MyCountries.Add("Greece")
MyCountries.Add("Ukraine")
MyCountries.Add("Malta")
MyCountries.TrimToSize()
MyCountries.Sort()
rb.DataSource = MyCountries
rb.DataBind()
End If
End Sub

Sub changed(ByVal Source As Object, ByVal e As EventArgs)
lbl1.Text = rb.SelectedItem.ToString
End Sub
</script>


That's it,

If you're using visual studio to do this, then copy the body of your load function to some place safe, then delete the entire function. In design view, go to you properties window, click the little lightning bold, and scroll till you find the page load function and double click it, allow VS to create the function, then paste your body back into it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.