|
Two problems...
1) Where are you setting "dr"? Somewhere in there, you probably want a line like dr = dt.Rows[i]
2) Rows are indexed from zero, so if you have 5 rows, their indices are 0, 1, 2, 3, 4. Your 'for' loop is going to count from 0 to 5 (0, 1, 2, 3, 4, 5)... You need make one tiny change to your stop condition
|
|
|
|
|
Hi, I create usercontrol in silverlight name it Pelampung.xaml, and it's have default constructor of the usercontrol : Pelampung.xaml.cs.
I create a class SpriteBase. And inherited this class into Pelampung.xaml.cs
this is the code of Pelampung.xaml.cs :
public partial class Pelampung : SpriteBase {
private PelampungType pelampungType;
public Pelampung(PelampungType pelampung_type, Boolean kananKeKiri)
{
pelampungType = pelampung_type;
KananKeKiri = kananKeKiri;
InitializeComponent();
Setup();
}
and this code of SpriteBase.cs :
public class SpriteBase : UserControl
{
private double xSpeed;
private double ySpeed;
private double padat;
private double angle;
private int jalan;
......
}
When I run it, the error list is
Partial declarations of 'Skripsi.Games.Game3.Game3Part.Pelampung' must not specify different base classes
It's all error in another usercontrol.
|
|
|
|
|
Try this for your derived class' constuctor:
public Pelampung(PelampungType pelampung_type, Boolean kananKeKiri):base()
EDIT (05/16/2011) =============================
For some reason, the html I put in to highlight the ":base()" portion of the line above is no longer being properly parsed by the site. Edited to remove the emphasis tags.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Monday, May 16, 2011 10:47 AM
|
|
|
|
|
how about the generalitation of SpriteBase.cs, in that class I create a code like this :
public class SpriteDasar : UserControl
{
...
protected Boolean KananKeKiri;
protected Double actualWidth;
protected Double actualHeight;
...
}
I call KananKeKiri in Pelampung.xaml.cs like this :
public partial class pelampung : SpriteBase
{
private TipePelampung pelampungType;
public pelampung(TipePelampung pelampung_type, Boolean kananKeKiri) : base()
{
pelampungType = pelampung_type;
KananKeKiri = kananKeKiri;
InitializeComponent();
Setup();
}
}
KananKeKiri, actualWidth, actualHeight, and all generalitation in SpriteBase unread. The namespace are right.
|
|
|
|
|
I have no idea what you're asking, and please learn how to properly post a block of code here.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Check your XAML code... I bet it looks something like this:
<UserControl x:Class="Skripsi.Games.Game3.Game3Part.Pelampung"
xmlns=....
And then your C# code says:
public partial class Pelampung : SpriteBase {
These both represent the same class, but one inherits from SpriteBase and the other inherits from UserControl. Gotta fix one or the other... They have to match.
|
|
|
|
|
Hi..
I need to export the datagrid values to the pdf & have to save the pdf file on the Disk..
|
|
|
|
|
|
Dear All,
We are using multiple WCF service in our silverlight project.
The problem is when we leave the service Idle for 3-4 minutes
we get problem. The exception is below::
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at TS.HrmsPortalApp.ExpenseSVC.ExpenseSVCClient.ExpenseSVCClientChannel.EndGetExpensePolicyDetail(IAsyncResult result)
at TS.HrmsPortalApp.ExpenseSVC.ExpenseSVCClient.TS.HrmsPortalApp.ExpenseSVC.ExpenseSVC.EndGetExpensePolicyDetail(IAsyncResult result)
at TS.HrmsPortalApp.ExpenseSVC.ExpenseSVCClient.OnEndGetExpensePolicyDetail(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
The service works fine and keeping service idle for only 2-3 minutes throws the above exception. We have set the timeout to 20 minutes. I don't know what exactly the problem is.
I would be very thankful to all of you if you could help me to get this problem resolved.
I have already increased the max sizes for various parameters.
Vinod Kumar Prajapati
Software Engineer
Tirsoft Systems Pvt Ltd
|
|
|
|
|
Hi Vinod,
Have you updated both the server web.config and the client Servicereference.Clientconfig, with the longer timeout settings?
Cheers,
Daniel
|
|
|
|
|
hi,
I need some help!!!
I have got two tables. Products and Producers. I receive both from my sql database and save them with dataadpter into two datatables and connect them by the datarelation. Both tables are in a dataset.
Product has the columns ID, productname and producerID. And some more, but they are not important for my question.
Producer has the columns ID and producername.
The relation should be clear by columnnames.
What i want:
i have a textblock and a dataset below. The dataset should contain all the products. In the textblock should be displayed the name of the producerscompany.
But this doesnt work, i cant bind the relation and then the name ( Binding producerrelation.producername)
On the other way, master/detail the binding to a relation is working, but i cant bind from detail to mastertable.
Does anybody know how??
Before i was trying this i used linqtosql, but it had such a bad performance that i decided to use ADO.net components.
With linq it was working fine.
Thanks a lot
|
|
|
|
|
In my Silverlight application, I occasionally need to send off async WCF requests to multiple WCF hosts. This works correctly, except when I get my responses back I find that I have no idea who sent them.
Instead of adding information about the caller to the response, I've added public object Tag to the XYZClient reference implementation generated by the Service Reference function. I can extract XYZClient from the sender and easily identify the connection, but it needs to be added every time the service reference is updated.
Is there an easier or preferred to tag a client with this kind of information?
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Aaron Stubbendieck wrote: This works correctly, except when I get my responses back I find that I have no idea who sent them.
I cannot understand your problem exactly. Silverlight uses async service calls, and each call has an async callback method, so the call has to come back to the async call back method right?
|
|
|
|
|
Maybe a code sample will help:
void MyFunction()
{
foreach(MyObject mo in MyObjectList)
{
XYZClient Client = new XYZClient(mo.Endpoint, ...);
Client.MyCallCompleted+=newMyCallHandler(CallCompleted);
Client.MyCallAsync(mo.ID);
}
}
void CallCompleted(object Sender, MyCallArgs e)
{
}
I need to call a different WCF based on a parameter in MyObject. MyCall is called for each of these services, but they all have the same event handler (CallCompleted). When I get the CallCompleted event, I don't know which MyObject is associated with the return, but I do get the same XYZClient back in the Sender parameter.
I add a Tag property to the XYZClient and tag it with Client.Tag=mo before making the async call, what way I know which mo is associated with the CallCompleted event.
My method works, but has to be re-added everytime I update the service reference. Is there a better way to do this?
modified 12-Jul-20 21:01pm.
|
|
|
|
|
I understand your issue now - have a look at the UserState object (returned in an async call).
See here[^] for more information.
|
|
|
|
|
Exactly what I needed, thank you!!
modified 12-Jul-20 21:01pm.
|
|
|
|
|
You are welcome.
|
|
|
|
|
Normally, to set style using C#, I write,
<br />
btn.Style = (Style)FindResource(_styleName);<br />
But what to do, if style is defined inside main 'ResourceDictionary', and button is inside some 'UserControl'. Also, we have to write script inside 'UserControl' only.
|
|
|
|
|
Hi all..
I ran into an issue while implementing BITS, the problem is while creating a job in BITS we have to send the local path (physical path like c:/doc/sample.txt) but Silverlight will not give us the physical path or fullpath. It says access denied.
How to get the physical path or fullpath of the file in silverlight?
Thanks
Nitin C.N
|
|
|
|
|
Silverlight doesn't allow access to client-side files. If you're talking about a server side file, look at the HtmlPage.Document object - you might be able to get it from that.
What is "BITS"?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
|
In addition to John's answer, if you are using WCF to communicate to BITS (Im not sure what that is), you can get the path via WCF.
|
|
|
|
|
Hi Nitin,
I think, I already answered your query through Twitter & my Blog.
You can't get the physical path in Silverlight (assume you want the client side path).
If you want server side path, it is easy to do in your server side code & return thru service call.
But, as it is Silverlight, I assume, you want the path of client PC. No, you can't. There are some security reason while the application is running inside the browser sandbox.
If you install it as fully trusted out-of-browser application, you can get it.
Read the Article for some reference: File Explorer using Silverlight 4 COM Interoperability[^]. It may help you.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Hi everyone,
I've got a Listbox which its itemsSource is binded with a large amount of data.
The binding is very slow so I would like to show a waiting message while the listbox is binding the data.
I need to know when the databinding has finished, does anybody know how do I do it?
Thanks in advance, and forgive me for my broken english!
|
|
|
|