|
Here is the problem: i try to fire an event from an imageButton created dynamically. But the compiler won't let me do it.
It springs an error: 'Public Event Click(sender As Object, e As System.Web.UI.ImageClickEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
I have seen it done in C#. Is there a VB.net solution? Simplified code below:
imports System
Imports System.Web.UI
Imports System.Web.UI.Webcontrols
public class domClss : Inherits System.Web.UI.Page
public myTable As System.Web.UI.WebControls.Table
sub Page_load(s as System.object, e as System.eventArgs) Handles mybase.load
if NOT page.isPostBack then
dim r as new TableRow()
dim c as new TableCell()
dim b as new System.Web.UI.WebControls.imageButton()
b.click = new System.Web.UI.ImageClickEventHandler(b_Click)
c.controls.add(b)
r.cells.add(c)
myTable.rows.add(r)
End if
End sub
Private void b_click(sender As System.Object, e As System.ImageClickEventArgs)
response.write ("button clicked")
end sub
End class
I certainly would appreciate some light on the problem.
Thanks in anticipation
Pyb
|
|
|
|
|
Changes to
Public myTable As New System.Web.UI.WebControls.Table
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim r As New TableRow
Dim c As New TableCell
Dim b As New System.Web.UI.WebControls.ImageButton
AddHandler b.Click, AddressOf b_Click
c.Controls.Add(b)
r.Cells.Add(c)
myTable.Rows.Add(r)
End If
End Sub
Private Sub b_click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Response.Write("button clicked")
End Sub
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
Hi Sanjay,
That "addhandler ..." line made all the difference. After some tidying up, it all works like a charm. Great stuff, thanks for your help, you're a champ.
Obviously the way I saw it operate in C# is quite different. It seems that VB.Net is not the exact carbon copy of C# I thought it might be. By the way, which of these two languages would you say is the most useful?
Cheers,
Pyb
|
|
|
|
|
I am trying to use MATLAB for its graphing capabilities, and need to write a .MAT file using visual basic. How can i do this, or where can i find info to do this? thank you. this may be a very basic question, but i am an amatuer programmer, so any info will help.
|
|
|
|
|
murphypa wrote:
How can i do this, or where can i find info to do this?
You can google for MATLAB File Format[^]
The first entry in the search result looks like what you are looking for.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
I need to start an existing sql dts package to transform text data into a sql table. (I have no sql experience) The package is housed within sql server. I know the server name and package name. Can anyone help me with a .Net example?
|
|
|
|
|
Try here.
How do you want to start your DTS Package today?
By Darren Green
http://www.databasejournal.com/features/mssql/article.php/1462561
|
|
|
|
|
I developed an application smart client to twirl in the net, when this application this twirling inside of my local net performace is excellent, however when I place it stops twirling using one link dedicated of 512kb the application is very slow in the client, have forms that they delay 40 seconds to be opened that they do not search given in the servers, or either use link not to search given to load in the screen.
You can help me?
|
|
|
|
|
Twirl????
What are you talking about? What does this app do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave, i am glad for your interesting.
The application was builded in VB .NET (smart client arquitecture) and i have some problems with performance when the client is running in remote locations (net bandwitdh 512kbs).
I already ready patterns and praticles and i thing that is very generics and i can not solve the problem.
However, if can help with some tick out trip i will very thankfully.
The problem consist in the net traffic (lazy response in fact). Exemple: one simple (a single form with a button, a textbox and one label) form take 30 seconds every time it is called.
Sorry about my bad english, i can explain again if necessary.
thanks a lot.
|
|
|
|
|
You haven't supplied any information as to what your form is doing. All I know is that your form takes 30 seconds to show up. Is this because your running your application from a remote location and downloading from the network somewhere? Is it because your code is doing somethin with the network? What is this app supposed to do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, this is my actually scennary:
I have a database and a components server in my local server. Internal clients can access this component server at 10 mb local network. In this case, the performance of my clients is excellent.
This is the problem scennary:
I have remote clients running this application and accessing this component server through a WAN at 512kb (ADSL) and the performance is very slow.
To try fix this problem a have builded a simple test application (File-New) and set a button, textbox and a label into this (nothing was codified) and try to execute this app in my remote clients, and the performance keep very slow.
The test app in most simple that is possible, running in a remote client.
I hope that you have understanding the problem.
tanxs
|
|
|
|
|
It's not much clearer, but I'll take a stab at it. Your client is instantiating a remote COM server object across a 512Kb link and getting very slow performance. Your more than likely not getting 512Kb permance on that link anyway, more like half that...
Unfortunately, I don't think there is anything you can do about it, short of redesigning your server component and not use remoting. A WebService would probably give your better performance, but the feasibility of that depends on your application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, let's start from begining.
Can you have some problem with client developed in VB. Net (smart client) arquitecture running in remote locations ?
Exist some trick configuration in the framework or IIS to make this client more smart ?
Can i make a faster remote client app (VB .NET) acessing a local web service ?
My app is based in .Net 3-tiers arquitecture and i not use COM+ components.
tanks
|
|
|
|
|
I'm affraid without much greater detail in what your app is doing, like HOW your client app is communicating with the server, what it's doing, ... there's nothing we can do to help you.
Marcus Travaglia wrote:
Can you have some problem with client developed in VB. Net (smart client) arquitecture running in remote locations ?
Silly question. Of course you can have problems. What those problems are is a another issue.
Marcus Travaglia wrote:
Exist some trick configuration in the framework or IIS to make this client more smart ?
More smart? What does that mean?
Marcus Travaglia wrote:
Can i make a faster remote client app (VB .NET) acessing a local web service ?
Sure. But that would involve running a web server on the local machine also. What would this WebService DO? What is its purpose? It doesn't make any sense what-so-ever to run a WebService locally on the client machine...
Look. Your not telling us anything about what your app is doing. What are you doing acrossed this connection? I'm just guessing because your not giving anywhere near the detail we need to troubleshoot your problem. There are many different ways of passing data nad objects acrossed a 3-teir platform. Samples of your code would help greatly!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, I have tried everything there is and I cannot get data to Merge into a DataSet. I have done this before, but now I am having problems with this particular piece of code. Here is the Error:
Constraint Exception:
System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
at System.Data.DataSet.FailedEnableConstraints()
at System.Data.DataSet.EnableConstraints()
at System.Data.DataSet.set_EnforceConstraints(Boolean value)
at System.Data.Merger.MergeDataSet(DataSet source)
at System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges, MissingSchemaAction missingSchemaAction)
at...
The DataSet is retrieved from the DB the first time fine. The DataSet contains 4 DataTables as well as some DataRelations. The 2nd time around, when I am trying to refresh the Data from the DB (but Preserve my changes) I get the above Error.
It is absolutely impossible, beyond any doubt, that there are "NULL" values in any Primary Keys or F-Keys used within the DataRelations. What can be causing this?
|
|
|
|
|
It's probably not a NULL value error, but your resulting dataset is violating the key constraints somehow. Possibly two records having the same key? That leads to another question...When you refresh the data, are you sure you're not appending a new copy of the data to the old version of the dataset?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, I figured this one out. Since I was retrieving data from Views, it wasn't able to determine the P-Keys on its own. I modified the Tables after data retrieval to have the Proper Key Columns on them. Afterwards, it worked great! So I guess in a sense, it was trying to append the same Records twice, and since I had Relationships setup, it was violating the Constraints.
|
|
|
|
|
I am trying to convert a VB6 project to a VB.net. My problem is that I am using an ActiveX control for charting and need to pass it an array of double. The following is an example that works well with C++ and VB6. But I need to find the dot net version of this.
C++ ActiveX function:
Short myfunction(double * data)
{
do something with data
}
VB6 function:
Dim data() as double
Dim retval as short
retval =Controlname.myfunction(data(0))
This code worked fine for VB6 to pass an array of doubles. But in VB.net only the first value in the array is passed and all the other values seem to be ignored.
If you have any suggestions I would appreciate it.
|
|
|
|
|
change
retval =Controlname.myfunction(data(0))
to
retval =Controlname.myfunction(data)
You are passing only first element
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfusingforeachwithcollections.asp
Hi! I have created a class library in C# using IEnumerable
interface as specified in above URL, Example 2.
Now, I am iterating the items from Visual basic but it is giving
error like Object does not support this property or method while
it works fine with .net. As mentioned in URL, it should work with
the VB also.
What can be the problem?
C# code is same as in URL, Example 2.
Here is the VB code:
Dim col As New MyCollection
Dim i As Object
For Each i In col
MsgBox (i)
Next
|
|
|
|
|
Dim i As Object ?
what's the reason you dim i As Object?
Dim col As MyCollection = New MyCollection ()
For Each i As Integer In col
MsgBox(i)
Next
|
|
|
|
|
Hi, I am going to take MCP exam 70-306.
Is there any e-books can be downloaded ?
What sources would be useful ?
Thanks,
NUrmat
|
|
|
|
|
I used the Osborne Certification Press MCAD/MCSD Book for 70-306. It helped a lot for the test and I passed with flying colors.
|
|
|
|
|
I also take MCP course too, but about windows 2000 networking. I think the best resource is Microsoft document. Try to read Microsoft press book, it contain a lot of document for people to prepare for an exam. Give you e-mail address, I will send an e-book to you. There 5 file which contain 8Mb. But each file is 2Mb max.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|