|
If you put a breakpoint on this line and then hover over the variables when you reach it, one of them will be set to null. This is the one that is failing - hint start at Globals and work from there - I'm going to guess that it's either ThisWorkbook or categoriesBindingSource that is null.
|
|
|
|
|
Thanks Pete for the quick reply.
I will check on this tomorrow morning. I will update with the results tomorrow mate.
Cheers,
Jayvee
|
|
|
|
|
No bother.
|
|
|
|
|
Hi,
I've a third party webservice and i've created a proxy C# class by using WSDL EXE. In that i've added one parameter called /urlkey:ServiceURL to change the Server location dynamically from App.Config file.
if ((urlSetting != null)) {
this.Url = urlSetting;
}
else {
this.Url = "http://101.54.6.9/services/ServiceInformation" +
"eHttpSoap11Endpoint";
Even after this if i change in App.Config file it doesnt work for me. So what is the solution to create proxy class and call properlly.
|
|
|
|
|
You can change the URL programmatically as well. Often that is what I end up doing in this sort of cases. Though, I cannot speak accurately if it will fix your problem or not. Just another avenue to consider.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Hi all,
I have the problem to step over a disabled control with GetNextControl(...,true).Focus to the next enabled one.
For example you have 3 textboxes with the tabindex 1,2,3 and a lot of other controls on the form. The focus is on the first textbox, the second one is disabled and I want to step to the third textbox with GetNextControl(...,true).
The effect is, that GetNextControl(....,true) jumps to a control for example with tabindex=73 but not to the third one.
What can I do to get the (correct) assumed reaction ?
tnx
Frank
|
|
|
|
|
This assumes that you're starting from textBox1 and at least one textBox is enabled (even if only textBox1).
Control control = textBox1;
do
{
control = GetNextControl(control, true);
} while (!control.Enabled);
control.Focus();
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Great,
that's what I'm looking for ?
Tnx
Frank
|
|
|
|
|
Well, you could do something like this:
Control ctrl = GetNextControl(...);
if (ctrl.Enabled)
{
ctrl.Focus();
}
I haven't actually tried this, but some variation of it should work.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
Also you could perhaps simply use SelectNextControl[^] without a loop, like:
textBox1.SelectNextControl(textBox1, true, true, true, true)
|
|
|
|
|
C# interface: how to indicate there needs to be a default constructor in an interface declaration?
Thanks!
dev
|
|
|
|
|
AFAIK, you can't. I believe the best you can do is create an abstract class (this can implement your interface if required) with a default constructor and derive from that. If a default constructor isn't provided in the derived class, then the base's implementation will be used.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
You can't. An interface is a contract not an implementation. What you could do is create an abstract base class that inherits the interface and add a no-args constructor to it. If you mark the interface method as virtual in the implementation, then child classes can add their own processing. Example:
public interface IMyInterface
{
void DoSomething(int count);
}
public abstract class MyBaseClass : IMyInterface
{
public MyBaseClass()
{
DoSomething(0);
}
public virtual void DoSomething(int count)
{
Console.WriteLine("Called : {0}", count);
}
}
|
|
|
|
|
You can specify that a generic type requires a default constructor by using the New() constraint.
public interface Fake<t> where T : new() {
</t>
This may get you close to what you want.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Hello,
I want to save my form object. I am not succeeding and some one told me that it is impossible to save form object. So I am asking is it possible to save form object or panel object.
If it is impossible then what should I do.
What is good way to serialize an object and save It.
Thanks in advance.
|
|
|
|
|
what do you mean by saving form object?
|
|
|
|
|
I want to save The same form which contain all the panels , text boxes, and Labels. I want to save this form object to a file what should I do.
|
|
|
|
|
You can't do this. A Form is not serializable, as well as the controls on it may not all be serializable either.
You have to write your own serializer to do something like this, where you provide the code to save whatever property values of the form, and all the child controls, required to recreate the objects using just that data.
|
|
|
|
|
Serializing objects that contain other objects is not trivial. A Google search[^] turns up many results including some CP articles.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Yes I did Google search but there problem. I am not asking only object serialization. I want to ask is it possible to serialize the object of the form in which I am working. and when I open this form again I want to get the saved object of my form.
Please give me guild line.
|
|
|
|
|
As davey said you have to use serialization which isn't an easy thing to do.
I would start with something simpler (if you'v never done it before) and work my way up to a form. (start with just a control or something like that)
Per definition you can serialize everything (as far as I know) so yes it's possible to serialize a form, but probably not going to be easy.
|
|
|
|
|
Yes I did serialization before but I never save Controls or form.
Now I have to save the full form object or I will save all the form controls and get there properties and then put them to another serialize class then I will save it(It is very lengthy process). But I am in search of short cut. Like this.
SaveObject(this);
MyClass clss =Retriveobject();
Is it possible.
If yes then how I am stucked.
|
|
|
|
|
it is possible but you'll have to serialize every object on the form, then serialize the form itself.
I have some code at home that does something like this I'll check it when I get home.
But don't count on it being as easy as you typed there, not going to be possible to do in 2 lines of code
|
|
|
|
|
It can be done but it's going to be slow! You'll need to use reflection to go through every property that you want to serialize. When you get to properties like Control, you'll have to do the same for every property of each control in the collection... There may be a better method but that's all I can think of.
This little example will get you started. I've hard coded a few properties, but to make it a complete serialization you'll need to use reflection to get the properties/values instead as I said above.
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
namespace FormSerializationDemo
{
[Serializable]
public partial class Form1 : Form, ISerializable
{
public Form1()
{
InitializeComponent();
using (MemoryStream stream = new MemoryStream())
{
SerializeMe(stream);
}
}
private void SerializeMe(Stream stream)
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, this);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("FormBorderStyle", FormBorderStyle);
info.AddValue("Location", Location);
info.AddValue("Name", Name);
info.AddValue("Size", Size);
info.AddValue("Text", Text);
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks for your reply and providing code.
It is a good example but I think it will not solve my problem. Because I have an array of panels. These panels contain Four type of controls but number of controls is vary in each panel.
with the your technique I think I cant add different panels with different controls.
Any way thank you very much.
|
|
|
|