I have a simple forms program that I have been fighting with for a while now. I simply want to be able to call a method from a different class file (when a certain step is triggered in the code in that class file) in order to insert a string in the listBox.
Here is my main method, pretty standard:
class Program
{
[STAThread]
s...
I have a gridview and, when a record is double-clicked, I want it to open up a new detail-view form for that particular record.
As an example, I have created a Customer class:
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlClient;
using Sy...
I am trying to do something like this:
property = 'name'
value = Thing()
class A:
setattr(A, property, value)
other_thing = 'normal attribute'
def __init__(self, etc)
#etc..........
But I can't seem to find the reference to the class to get the setattr to work the same as just assigning a variable in the class definition. ...
Lets say we have a code portion like this :
IProduct product = ProductCreator.CreateProduct(); //Factory Method we have here
SellThisProduct(product);
//...
private void SellThisProduct(IProduct product)
{
//..do something here
}
//...
internal class Soda : IProduct
{}
internal class Book : IProduct
{}
How can I infer which pro...
This is a topic that, as a beginner to PHP and programming, sort of perplexes me. I'm building a stockmarket website and want users to add their own stocks. I can clearly see the benefit of having each stock be a class instance with all the methods of a class. What I am stumped on is the best way to give that instance a name when I ins...
Hi I generate Dao classes for some DB operations
in this manner making methods of Dao class as static or none static is better?
Using sample dao class below ,İf more than one client got to use the AddSampleItem method in same time?how this may result?
public class SampleDao
{
static DataAcessor dataAcessor
public static void ...
OK, this is a super super noob question, one that I'm almost embarrassed to ask...
I want to reference a class in my XAML file. It's a DataTemplateSelector for selecting the right edit template for a DataGrid column.
Anyway, I've written the class into my code behind, added the local namespace to the top of top of the XAML, but when I ...
Hey,
I'm working on a small roguelike game, and for any object/"thing" that is not a part of the map is based off an XEntity class. There are several classes that depend on it, such as XPlayer, XItem, and XMonster.
My problem is, that I want to convert a pointer from XEntity to XItem when I know that an object is in item. The sample ...
Hopefully a quick fix after spending quite a few hours trying to get this to work:
Basically I to ONLY add the class "active" to .trigger anchor when when it has either been clicked or the cookie has made it open. And when the anchor is clicked again to close the container remove the class "active".
Here is my code. Thanks.
$(document...
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Upload(Photo photo)
{
foreach (string file in Request.Files)
{
var path = "~/Uploads/Photos/";
HttpPostedFileBase posted = (HttpPostedFileBase)Request.Files[file];
if (posted.ContentLength > 0)
{
photo.Date = DateTime.Now;
...
Can someone tell me why I cannot write a class as follows
<?php
class Foo
{
?>
<?php
function bar() {
print "bar";
}
}
?>
I think it's the same as
<?php
class Foo
{
function bar() {
print "bar";
}
}
?>
...
Hey everyone,
So, for a very silly project in C++, we are making our own long integer class, called VLI (Very Long Int). The way it works (they backboned it, blame them for stupidity) is this:
User inputs up to 50 digits, which are input as string.
String is stored in pre-made Sequence class, which stores the string in an array, in re...
Normally when I have a private field inside a class or a struct, I use camelCasing, so it would be obvious that it's indeed private when you see the name of it, but in some of my colleagues' C# code, I see that they use m_ mostly or sometimes _, like there is some sort of convention.
Aren't .NET naming conventions prevent you from using...
class CRectangle {
int x, y;
public:
void set_values (int,int);
int area (void);
} rect;
In this example, what does 'rect' after the closing brace and between the semi-colon mean in this class definition? I'm having trouble finding a clear explanation. Also: Whatever it is, can you do it for structs too?
...
I see the word thrown around often, and I may have used it myself in code and libraries over time, but I never really got it. In most write-ups I came across, they just went on expecting you to figure it out.
What is a Class Factory? Can someone explain the concept?
...
I am looking for a class to parse root zone files.
Have you seen one? My current script is in php so the class would need to be as well.
G-Man
...
Is it possible in a .NET app (C#), to conditionally detect if a class is defined at runtime?
Sample implementation - say you want to create a class object based on a configuration option?
...
Hello. I am currently creating a multi-view game on the iPhone platform. I have my main view start to play some background music upon loading. I then go to another view and start the game. I am trying to get the background music from the original view to stop once I start the game. I am having trouble getting the stop playing music ...
Hi, I don't know if a solution exists but it would be highly desirable.
I'm making a Scala Applet, and I want the main Applet class to be a singleton so it can be accessed elsewhere in the applet, sort of like:
object App extends Applet {
def init {
// do init here
}
}
Instead I have to make the App class a normal instantiatab...
I have an array of pointers to a base class, so that I can make those pointers point to (different) subclasses of the base class, but still interact with them. (really only a couple of methods which I made virtual and overloaded) I'm wondering if I can avoid using the pointers, and instead just make an array of the base class, but have ...