|
anu gunturi wrote: im a fresher 4r dotnet .... hope u ll understnd my lang....
Then why are you doing this instead of something more straightforward ? It looks like you're using a third party component to do this. Where is it not working ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi..
i want to take average of different price of same product..
For Example
i perches a Oil in different prices i want to show the average of Oil price.
hope u understand my problem
thanks in advance
jawad khatri
|
|
|
|
|
Sounds like basic maths to me. Is it homework ? What have you tried ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
what did you try? where did you stuck?
please be specific with your questions, so that it will be easy to get answers...
AFAIK, avg = sum / no_of_items;
was this your question???
Have a Happy Coding.....
|
|
|
|
|
There is an ActiveX dll in C++ that has some function:
void function(unsigned char* buffer, unsigned long* size);
I added its reference in C# project from COM components tab.
However in C# function it is defined as
void function(out byte buffer, out uint size);
The dll just writes to buffer some bytes array of specific size.
How can we pass that allocated byte[] array to C# implementation?
Чесноков
|
|
|
|
|
Hi,
I'm not sure it works the same for ActiveX, however using P/Invoke to call a native code function I would use:
- either the pointer to a pinned byte array (for binary data);
- or a StringBuilder with a sufficient capacity (for ANSI or Unicode text).
Here are two ways to handle an array (example uses int array, similar for byte[]):
unsafe public int ArrayFixed() {
int dim=1000;
int[] numbers=new int[dim];
...
int sum;
fixed (int* pNumbers=&numbers[0]) {
sum=SumArray(pNumbers, dim);
}
return sum;
}
[DllImport("native.dll")]
unsafe public static extern int SumArray(int* pNumbers, int count);
and
public int ArrayHandle() {
int dim=10000;
int[] numbers=new int[dim];
...
GCHandle handle=GCHandle.Alloc(numbers, GCHandleType.Pinned);
int sum=SumArray(handle.AddrOfPinnedObject(), dim);
handle.Free();
return sum;
}
[DllImport("nativeC.dll")]
public static extern int SumArray(IntPtr pNumbers, int count);
Note: no out keyword is used for arrays.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hello.
What is the use of COM registered component? If you can not use them as a reference module added to the project?
The definition of the function in metadata is different than in C++. It takes just 1 byte instead of bytes array.
Is that just the programmers failure or there is a way to pass to out byte buffer a byte[] array ??
Чесноков
|
|
|
|
|
if it is just one byte then out byte buffer would be fine, but then buffer isn't the best name for it.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi All,
Please tell me how to write XML query in Asp.net.
I hav temple.xml file which contain data of temple.
now i want to apply search on it.
|
|
|
|
|
Load the XML file into XmlDocument instance and write XPath[^] query.
Best wishes,
Navaneeth
|
|
|
|
|
The ASP.NET part is irrelevant. You want to use C#. So, what version of C# do you have ? That will determine if you want to use LINQ or if you need to use the XMLDocument class.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
public class MyClass
{
private string _MyProperty = "the property";
[colName="theColumn"]
public string MyProperty
{
get { return _MyProperty; }
set { _MyProperty = value; }
}
public string GetName()
{
// code to implement
}
}
public class MyClassTest
{
MyClass c=new MyClass();
// I want to get the attribute in the following way:
string colName= c.MyProperty.GetName();
//colName should be theColumn
}
any kind of help would be appriciated.
and it should be in .NET 2.0 framework
|
|
|
|
|
Why do you want to do this ?
The value is going to exist at the class level, you can't change attributes for class instances AFAIK. They are used to specify things for all instances of a class.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I want to do this for the following scenarios:
say I want to Get an object into database.
And I need the column name for WHERE clause
e.g
// Get employees
Get method is like as follows
EmpDA.Get(string filterExpression)
{
//------- the code
}
Employee emp=DAEmp.GetByID(7);
emp.Salary=20000;
EmpDA.Get(string.format("{0}>{1}",emp.Salary.GetFieldName,emp.Salary);
please look at the following factors.
1) I am getting emp list using where clause as "Salary> 20000"
2) But I want to Get the column name "Salary" using emp.Salary.GetFieldName()
thanks for your reply
|
|
|
|
|
As Graus said, i too dont find its a better solution for this problem!
but still, you can get the custom attribute values by the following statement.
colNameAttribute mAttribInstance = (colNameAttribute)c.GetType()
.GetCustomAttributes(typeof(colNameAttribute),false).GetValue(0);
The object mAttribInstance will hold the various properties values within your "colName" attribute class. and you can access them by their respective name..
for e.g if "name" is the string used then,
mAttribInstance.Name will give you the value "theColumn"
Have a Happy Coding.....
|
|
|
|
|
Thanks King Julien for your reply.
I have already used it when interacting with database for insert update fields
but now my problem is to get the column name "theColumn" in the following fashion.
string colName= emp.Salary.GetColName(); //colName should be "theColumn";
look at the GetColName() after the property Salary. emp.Salary.GetColName();
I am using c# 2.0 framework.
|
|
|
|
|
i see...
in that case you may need to create a new class with the function GetColName();
and use it as your return type for property.
example:
Class yourClass
{
public string GetColName()
{
colNameAttribute mAttribInstance = (colNameAttribute)this.GetType().GetCustomAttributes(typeof(colNameAttribute),false).GetValue(0);
return mAttribInstance.Name;
}
}
and u can set the return type of the property salary as yourclass and you will be able to access the GetColName() method!!
Have a Happy Coding.....
|
|
|
|
|
I am looking for an open source component in C# that can be used in a windows application that allows keyboard input (like a DOS command window) and text output on the screen for an embedded command interpreter. I can probably write one myself if need be, but I am working on an open source application and would like to use components like this as much as possible. Does anyone know where I can find such a thing?
Thanks,
Bill
|
|
|
|
|
Um. There is a well hidden part of Visual Studio that might help, but it is not at all obvious how you get to it.
Follow the following instructions exactly:
1) Run VS
2) from the Menu: select File...
3) Select New...
4) Select Project
5) On the dialog, select Console Application
6) Press OK.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks, but I'm not looking for a console application, which I am very familiar with. I'm looking for a Form thast can run inside a windows forms application that isn't a text box control but allows both input and out similiar to a command window.
|
|
|
|
|
i get the remote screen picture,but i don't know the cursor position,so that i want to draw a picture to be always follow with the mouse cursor,so i can know where is my cursor in remote computer.
thanks for your help ,i am sorry of my English,wait for you help!
comLee
2009-11-4
|
|
|
|
|
Why can't you see the cursor ? What software are you using ? You can create a program which positions itself over the mouse, just a timer and code to get the cursor position. Sounds ugly tho.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thanks for you reply,i get the screen by my program
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics gp = Graphics.FromImage(bmp);
gp.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
ms = new MemoryStream();
Image im = bmp.GetThumbnailImage(Screen.PrimaryScreen.Bounds.Width / 10, Screen.PrimaryScreen.Bounds.Height / 10, null, IntPtr.Zero);
bmp = new Bitmap(im);
bmp.Save(ms, ImageFormat.Jpeg);
by = ms.GetBuffer();
return by;
i just copy the code from the internet,it can not work for getting cursor of mouse,so i want to draw a picture around the cursor.
i am the first time to ask for help in English,and receive you help so quick ,i am very happy ,thanks a lot!
i just a green hand in programing and English.
Please bear with me
|
|
|
|
|
I'm not sure this does remotely what you want. Yes, the first three lines gets you the screen, and if you used Cursor.Position ( from memory ), you could draw onto that bitmap. But that bitmap is a COPY of the screen, it's not the actual screen.
Why do you need a thumbnail of the screen ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Here I can not access your blog,Do not know how's going on。
|
|
|
|