|
Hey,
Thanks for taking time to reply to this one.
Yes I do understand and I hope this is the only explanation.
It is not the same in other languages that I know, Example this kind of error does not occut in C or maybe even C++. Still it was a great help.
But I still cannot understand why it was gievn in that book, when the code is generating errors.
Anyways
Thanks a lot
Love
Chameleon
|
|
|
|
|
The Chameleon wrote: But I still cannot understand why it was gievn in that book, when the code is generating errors.
It's a mistake in the book. It happens.
The Chameleon wrote: this kind of error does not occur in C or maybe even C++.
Right, just remember that .NET manages memory differently. Class objects are stored in the heap and are always referenced (in C++ an object can be in the stack or heap). Structures are stored in the stack and are passed by value, just like an Integer. In fact the Integer is really a structure too! It's mapped to the Int32 structure. Short, Long, Single (float), Double, and other primitive types are structures as well. An array is really a class and is something that must be created on the heap.
|
|
|
|
|
It's simply an error in the book.
The error message is completely correct. You can't create an array in the declaration of the structure, you have to create it in the constructor of the structure.
Declare the array as:
Dim EMail() as String
In the constructor of the struct, you create the actual array:
EMail = New String(10)
[With reservations for errors in the code, I normally program in C#]
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot for your advice,
It's been really helpful
Regards
Chameleon
|
|
|
|
|
How can we display a message whenever a text box goes out of focus? say if you want to check if the entered value is 0 and display a message only when it is so?
|
|
|
|
|
By handling the Leave event on the textbox.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Try this :
In VB.net
Private Sub TextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox.LostFocus<br />
' Your Code Goes Here<br />
End Sub
In VB6
Private Sub TextBox_LostFocus()<br />
' Your Code Goes Here<br />
End Sub
It will trigger Lost Focus event in text box "TextBox"
WiL
|
|
|
|
|
|
Hi,
This would be a server side validation code. Anyway that we can use this one only on the client side say using Java script?
|
|
|
|
|
I didnt get what do you mean by "server side validation code". But if you were asking if JavaScript support lost focus event, the answer will be yes.
WiL
|
|
|
|
|
Well,
First of all thats for taking interest.
Now my application is an ASPX application with two sides. One is .VB part where the actions and the code is run on the server and second is the ASPX part where the information is displayed to the client (Preferably in IE or some other browser).
The code that you gave me is working fine but can be only used to validate a certain evernt that is being run on the code. For validation on the client side, I would have to use some scripting language (Preferably Java Script) so that I do not have to post back to the server and thus minimize traffic.
Just wanted to ask if you have any idea how the same concept can be used in Client side validation?
Thanks
The Chameleon
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Untitled Page</title> <br />
<script language="javascript" type="text/javascript"><br />
function Text1_onblur() {<br />
}<br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<input id="Text1" type="text" onblur="return Text1_onblur()" /> </div><br />
</form><br />
</body><br />
</html>
Dude, I know nothing at all about aspx nor javascript. All I just did was open Visual Studio, add a text box, view the source code, select my text box name and choose an event. It automatically generate those codes.
What I'm trying to say is you should explore more about .Net by yourself before asking and also there's MSDN where you can find answer for most of your problems.
CMIIW
WiL
|
|
|
|
|
Dear all,
I was trying to automatically to import data from excel into Access Database.
The code was like this.
Dim myUploadConnection As New ADODB.Connection<br />
Dim SQLString As String<br />
Try<br />
myUploadConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\HDTL.xls; Extended Properties=Excel 8.0;"<br />
myUploadConnection.Open()<br />
<br />
SQLString = "SELECT * INTO " & _<br />
"[PROVIDER=Microsoft.Jet.OLEDB.4.0; DRIVER={Microsoft Access Driver (*.mdb)}; " & _<br />
"DBQ=" & Application.StartupPath & "\PlasmaDB.mdb;].HDTL " & _<br />
"FROM [HDTL$]"<br />
<br />
myUploadConnection.Execute(SQLString)<br />
myUploadConnection.Close()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")<br />
End Try
When run the proses I received error message "Can't Update. Database or object is read only".
Please tell what have I missed
Many thanks and regards,
WiL
|
|
|
|
|
hi all,
i have my web application running on a server and i found out that the aspnet_wp.exe process causing a high CPU usage on the server (running win server 2k with IIS 5.0 and .net framework 1.1). It caused my application running slow and stopped responding. Is that the framework problem? Any ideas how to solve that? thanks in advance
elcheah
|
|
|
|
|
That depends entirely on what code is running to cause the high CPU usage. Normally, this is something you wrote and not a problem with IIS or the .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
System.NullReferenceException: Object reference not set to an instance of an object. at ForumVB.dotForumTopicEdit.editTopic.submitter_update(Object sender, CommandEventArgs e) in c:\inetpub\wwwroot\ForumVB\admin\topicEdit.aspx.vb:line 109
plz help me...........
|
|
|
|
|
Go to topicEdit.aspx.vb, line 109. Some object there which you're trying to use has a value of null.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
but i already set particular object to allow Null in my database..... why stil got such error???
|
|
|
|
|
Because your trying to call an instance member on something that doesn't have an instance. Without seeing your code around the line that the error is occuring on, we can't help you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
oic, i understand ur meaning... anyway thanks a lot for ur explaintion
Thanks
|
|
|
|
|
I have finished my application, and I since the application will open in the users computer every whole day. I am going to see the memory usage.
It is shock!!
it use up me 45MB memory!!
and I find that, when I change the image of picture box, it use 1MB each time.
How can I free those memory ?
My code in this field is really simple,
<br />
picPreview.Image = Bitmap.FromFile(tempPreviewFile)<br />
Thank you!
|
|
|
|
|
I guess the picture box doesn't manage the memory as it should. Try calling Dispose on the Image before setting another. A better solution is not to use the picture box at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First, don't use TaskManager to look at your memory consumption. You're seeing the memory that your the CLR RESERVES for the entire virtual machine your app is running in, not necessarily used by your application.
Use the Performance Monitor and the .NET counters to see your actual memory consumption. You can also use a memory profiler, like CLRProfiler, to see exactly how your app is allocating memory.
Also, if you do discover that your app isn't releasing memory, make sure you Dispose any graphics objects you're using, specially any and all GDI objects. This also includes images, like Image and Bitmap objects!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|