I want to know how can we open a file dialog from withing a class module in vb6. I know how to do in forms, but I have to open it from within a class module.
I have a variable called $theclass and it's a string "Home_class". How can I define a class out of that string? The reason I need to do this is that the variable will change and I want to be able to declare the class that the variable is equal to. Is this possible?
Thanks for any help.
Hi ,
Please give me a real time simple example for the below questions :
Where to use interface rather abstract class
Where to use abstract class rather interface
I need code snippet for both .
Which takes low memory and which performs well . Do I need to consider the design aspect also?
What is the conceptual difference not the syntactical difference .
What is the difference between the following class methods?
Is it that one is static and the other is not?
Class Test(Object):
def method_one(self):
print "Called method_one"
def method_two():
print "Called method_two"
a_test = Test()
a_test.method_one()
a_test.method_two()
Hi, when using scaffolding on a controller the views render fine and the app even attempts to insert the data; the problem is that the scaffold is completely ignoring the relations I'm defining in my model class, in fact it's ignoring the class entirely as I can delete the file and the controller still scaffolds and render the crud from the table.
Has this ever happened to you?
hi,
i load a class using
Class.forName(klassname,false,loader)
After this i create an instance using
klass.newInstance();
It returns an object type.I want to cast it to specific type(ie.Klassnamw instance).I used normal casting but it gets hung because it is not resolved during runtime.How can i cast it?Hellp
Hey all, I'm working on building my own string class with very basic functionality. I am having difficulty understand what is going on with the basic class that I have define, and believe there is some sort of error dealing with the scope occurring. When I try to view the objects I created, all the fields are described as (obviously bad pointer). Also, if I make the data fields public or build an accessor method, the program crashes. For some reason the pointer for the object is 0xccccccccc which points to no where.
How can a I fix this? Any help/comments are much appreciated.
//This is a custom string class, so far the only functions are
//constructing and appending
#include<iostream>
using namespace std;
class MyString1
{
public:
MyString1()
{
//no arg constructor
char *string;
string = new char[0];
string[0] ='\0';
std::cout << string;
size = 1;
}
//constructor receives pointer to character array
MyString1(char* chars)
{
int index = 0;
//Determine the length of the array
while (chars[index] != NULL)
index++;
//Allocate dynamic memory on the heap
char *string;
string = new char[index+1];
//Copy the contents of the array pointed by chars into string, the char array of the object
for (int ii = 0; ii < index; ii++)
string[ii] = chars[ii];
string[index+1] = '\0';
size = index+1;
}
MyString1 append(MyString1 s)
{
//determine new size of the appended array and allocate memory
int newsize = s.size + size;
MyString1 MyString2;
char *newstring;
newstring = new char[newsize+1];
int index = 0;
//load the first string into the array
while (string[index] != NULL)
{
newstring[index] = string[index];
index++;
}
//load the second string
while (s.string[index] != NULL)
{
newstring[index] = s.string[index];
index++;
}
//null terminate
newstring[newsize+1] = '\0';
delete string;
//generate the object for return
MyString2.string=newstring;
MyString2.size=newsize;
return MyString2;
}
private:
char *string;
int size;
};
int main()
{
MyString1 string1;
MyString1 string2("Hello There");
MyString1 string3("Buddy");
string2.append(string3);
return 0;
}
I have a hyper link control and I set the NavigateURL and the ImageURL property at runtime. I also need to set the class of the image tag that it generates but I cannot figure out how I can do that. The solution mentioned here
http://stackoverflow.com/questions/1428879/apply-css-class-to-image-in-asphyperlink
does not work because the image url is hard coded.
any ideas?
Is it possible to get a reference to this from within a Java inner class?
i.e.
Class outer {
void aMethod() {
NewClass newClass = new NewClass() {
void bMethod() {
// How to I get access to "this" (pointing to outer) from here?
}
};
}
}
Please advise me the difference between two ways of declaration of java constructor
public class A{
private static A instance = new A();
public static A getInstance() { return instance;
}
public static void main(String[] args) {
A a= A.getInstance();
}
}
AND
public class B{
public B(){};
public static void main(String[] args) {
B b= new B();
}
}
Thanks
Hi,
I have a Android class extending Application to generate some global classes, etc.
It works, in that I can, for example, get the context, etc.
BUT, when I try this:
row = (TextView) findViewById(R.id.list_row_text);
I get
R.id.list_row_text = Class not loaded : <mypackage>.R$id
Any ideas why this is happening?
Thanks
Gerardo
For debug reasons, and curiosity, I wish to list all classes loaded to a specific class loader.
Seeing as most methods of a class loader are protected, what is the best way to accomplish what I want?
Thanks!
It is possible to call methods on a class whose interface is not exposed through an .idl file?
Im my particular case I'd like to use the @mozilla.org/gfx/fontmetrics;1 class, whose interface nsIFontMetrics doesn't have a correspondent .idl file.
Why on earth won't this compile? Scala 2.8.0RC3:
Java
public interface X {
void logClick(long ts, int cId, String s, double c);
}
Scala
class Y extends X {
def logClick(ts: Long, cId: Int,sid: java.lang.String,c: Double) : Unit = {
...
}
}
Error
class Y needs to be abstract, since method logClick in trait X of type
(ts: Long,cId: Int,s: java.lang.String,c: Double)Unit is not defined
Is there a way to pickle a class definition?
What I'd like to do is pickle the definition (which may created dynamically), and then send it over a TCP connection so that an instance can be created on the other end.
I understand that there may be dependencies, like modules and global variables that the class relies on. I'd like to bundle these in the pickling process as well, but I'm not concerned about automatically detecting the dependencies because it's okay if the onus is on the user to specify them.
hi..
i want to log messages from multiple classes. the problem is that currently i can log all messages into single file.i want to do this class A should log its messages into ALog.txt and class B should log its messages into BLog.txt
please tell me the sample config file for these settings
How to implement a static function in an abstract class?? Where do I implement this?
class Item{
public:
//
// Enable (or disable) debug descriptions. When enabled, the String produced
// by descrip() includes the minimum width and maximum weight of the Item.
// Initially, debugging is disabled.
static enableDebug(bool);
};
Let's assume I have a class ClassWithMember
class ClassWithMember
{
int myIntMember = 10;
}
How do I get the default value 10 of the myIntMember member by System.Type?
I'm currently struggling around with reflections by all I retreive is the default value of int (0) not the classes default member (10)..
Hi,
Struct has default access specifier is public where as class has default access specifier is private. So why can't use struct if change default access specifier as private? why class?
Thanks,
kam
I have used MFMailComposeViewController class in my iPhone app for email functionality.When I try to fill email body keypad comes.Here How can I use resignFirstResponder for that email body textfiled in MFMailComposeViewController class.
I have a project that has a GUI (written in QT) and a command-line version. I made use of the rectangle class included in QT: QRect. I would like to break the command-line version's dependency on QT, so I need a drop-in rectangle class that supports intersection and union. I could write one, but I'd prefer including one if possible.
Any ideas?
Can I get JAXB 2.0 XJC compiler to generate a generic class for me?
Something as simple as:-
public class Shape<T> {
T myShape;
// getter / setter
}
I see references for this in the spec but am not sure I'm reading it right. I always get Object references.
Resolving a class that has multiple constructors with NInject doesn't seem to work.
public class Class1 : IClass
{
public Class1(int param) {...}
public Class1(int param2, string param3) { .. }
}
the following doesn’t seem to work:
IClass1 instance =
IocContainer.Get<IClass>(With.Parameters.ConstructorArgument(“param”, 1));
The hook in the module is simple, and worked before I added the extra constructor:
Bind().To();
Thanks in advance...
When defining nested classes, is it possible to access the "outer" class' methods? I know it's possible to access its attributes, but I can't seem to find a way to use its methods.
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && //<-- Here I'd like to
} // reference a method
}); //from the class where
//addMouseListener() is defined!
Thanks