|
I'm sorry, but your question doesn't make too much sense. Do you want to know how to trigger a build off the build menu? Or about MSBuild?
|
|
|
|
|
No friend,I just wanna create a shared assembly in c#2.0.
Hi,Im Razana
|
|
|
|
|
Still. What do you mean? What is your exact problem? That's still too vague and open to interpretation.
|
|
|
|
|
I suppose you want to create a dynamic library (DLL) to share your classes and methods. Then make a new "C# Class Library" project in VS. Do some coding, compile and add it to another project(s) as a reference.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Hello...
private void button1_Click(object sender, EventArgs e)
{
Invoke(new MethodInvoker(MyMethod));
}
or...
private void button1_Click(object sender, EventArgs e)
{
if(InvokeRequired)
{
Invoke(new MethodInvoker(MyMethod));
}
else
{
MyMethod();
}
}
What are the differences ?
Why should I use "InvokeRequired" ?
I can use Invoke method in main thread and another thread also.
|
|
|
|
|
Hi,
first of all I think you have choosen a bad example. When receiving a Click event of a button it is clear it will be in the same thread as the container was created in.
Now to your question:
Invoke delegates a call into the thread the control was created in. This is necessary as Windows can react in confusing ways when it is not done. The InvokeRequired version will only do this when it is necessary. If the caller is already in the correct thread it will return false and thus call the method normally. As Invoke is rather expensive compared to a normal method call this might give you a performance benefit. But if you are sure that it is always needed the extra InvokeRequired call might also reduce performance.
Robert
|
|
|
|
|
Hi,
I created a Dialog box in c#/.NET and I tried to retrieve a data from a combo box present in that Dialog box. I am able to retrieve data using a Property. But at one point of time, I am getting an InvalidOperationException.
Can anyone help me out!
here is the code...
PanelSelectDialog dlg = new PanelSelectDialog();
dlg.ShowDialog();
if (dlg.DialogResult == DialogResult.OK)
{
str = dlg.SelectedPanel;
MessageBox.Show(str);
}
...
...
public partial class PanelSelectDialog : Form
{
public PanelSelectDialog()
{
InitializeComponent();
PanelList.Items.Add("hi");
PanelList.Items.Add("bye");
}
public String SelectedPanel
{
get
{
return PanelList.SelectedItem.ToString();// PanelList is the
//name of combo box
}
}
}
}
Thanks in advance
satheesh
|
|
|
|
|
satheesh.yuva,
Which line is the error happening on?
Regards,
Gareth.
|
|
|
|
|
Hey guys,
I am writing a program that works with the registry.
I have the following problem when I want to read REG_SZ values. I don't know how to separate the values correctly.
Example:
Key - HKEY_LOCAL_MACHINE\Software\Classes\AviFile\Shell\Play\Command
ValueName - (Default)
C:\Program Files\Windows Media Player\wmplayer.exe /prefetch:8 /Play "%L"
Might appear also as
"c:\program files\windows\media player\wmplayer.exe" /prefetch:8 /Play "%L"
If I split the string using '"' or ' ' it won't work in all of the cases.
It's not like with parsing command line arguments where you know that a path with spaces in it will have the correct punctuation.
How does microsoft know how to parse these strings correctly?
|
|
|
|
|
mjmim wrote: How does microsoft know how to parse these strings correctly?
I cannot confirm this but I read once that they have software developers working there.
led mike
|
|
|
|
|
.
Any real answers?
|
|
|
|
|
Ok, so this is the first time I am posting up an article about programming. After reading the help I understand that I am to post up my coding, point out the obvious and state my problem so i will do that now...
1- The code:
using System;
using System.Collections;
using System.Collections.Generic;
class ClassX
{
//receives the dependent 'y' variable and then the regressors in the cast: lists<double> only
public static Matrix beta(List<double> y, List<double> reg1, List<double> reg2, List<double> reg3, List<double> reg4, List<double> reg5, List<double> reg6)
{
int n = ret_nzd.Count;
//first get the regressors into a 2-D array and then matrix into a n*7 sized matrix
double[,] a = new double[n,7];
for(int iy=0;iy<7;iy++)
for (int ix = 0; ix<7; n; ix++)
{
if (iy == 0)
a[ix, iy] = 1.0;
if (iy == 1)
a[ix, iy] = reg1[ix];
if (iy == 2)
a[ix, iy] = reg2[ix];
if (iy == 3)
a[ix, iy] = reg3[ix];
if (iy == 4)
a[ix, iy] = reg4[ix];
if (iy == 5)
a[ix, iy] = reg5[ix];
if (iy == 6)
a[ix, iy] = reg6[ix];
}
//now get the dependent variable,y, into a n*1 array and then matrix
double[,] yarray = new double[n,1];
for (int ix = 0; ix<7; n; ix++)
yarray[ix,0] = y[ix];
//define new matrices
Matrix X = new Matrix(a);
Matrix Y = new Matrix(yarray);
Matrix BetaMatrix = new Matrix(7, 1);
Matrix XTemp = new Matrix(7,7);
Matrix XdashXInverse = new Matrix(7,7);
Matrix XTransY = new Matrix(7,1);
//X'X:
Matrix XTrans = X.Transpose();
for (int ix = 0; ix < 7; ix++)
{
for (int iy = 0; iy < 7; iy++)
{
for (int iz = 0; iz < 7; iz++)
{
XTemp[ix, iy] += XTrans[ix, iz] * X[iz, iy];
}
}
}
//(X'X)^-1:
XdashXInverse = XTemp.Inverse();
//X'Y = 7*1
for (int ix = 0; ix < 7; ix++)
{
for (int iz = 0; iz < n; iz++)
{
XTransY[ix, 0] = XTrans[ix, iz] * Y[iz, 0];
}
}
//(X'X)^-1 (X'Y):
for (int ix = 0; ix < 7; ix++)
{
for (int iz = 0; iz < n; iz++)
{
BetaMatrix[ix, 0] = XdashXInverse[ix,iz] * XTransY[iz, 0];
}
}
return BetaMatrix;
}
}
2- The obvious:
I am trying to obtain a linear multi-regression model in c# but I wanted to build most of the modeling myself in order to learn c#. What you can see so far is that my data is coming in the form of a list<double> where the dependent variable is labelled y and the regressors are named reg1,...,reg6 with a count of about a thousand data points. and i want a 2d array so that i can convert to a amtrix and hence do some matrix operations on.
3- The problem:
I am using a cs file (matrix class) produced by Syed Mehroz Alam where the article was produced on this forum titled 'Application of Fraction class: Matrix class in C#'. I will not show his code as I dont think it is appropriate for me to post something produced by someone else without their consent. My problem then becomes when i try running the programme. basically I get an error from the matric class stating:
catch (Exception)
{
throw new FractionException("Conversion not possible");
}
I am not sure what I am doing wrong to get this exception error message from the matrx class. Can anyone please help?
|
|
|
|
|
Change that code to
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
throw new FractionException("Conversion not possible");
}
and see what it shows you. Better yet, set a breakpoint and step through the code to see which line blows up. The debugger will let you look at the exception details, even if you don't assign the exception to a variable.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
I want to invoke methods from the unmanaged code(COM component.).
I want some suggestion for that, should i go for managed C++ wrapper or
will be it OK if i go for C#.
Basically main problem with the com is that, it has exposed one
method named Init((Inknown *) *pSYNInfo).
But they don't have exposed the SYNinfo class, which needs to be
passed to Init function. So what approach should i do so that i can
invoke the Init() function after setting the proper values to the SYNInfo
Class. Can i access the SYNInfo file by adding the header file in the
managed C++. Please help me out.
Thanks in advance.
|
|
|
|
|
|
|
What do you mean by 'special' ???
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I guess he means escape characters.
|
|
|
|
|
That's one reasonable guess. Characters not allowed in a filename is another. It's really impossible to tell.
And it's incredible how many people come here, ask oblique questions and never answer when you ask for more information to try to help them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: What do you mean by 'special' ???
It eats all its meals with a spoon, and married its cousin.
|
|
|
|
|
Hi,
If you use an automatic property and want to reference it within the same class I assume you would specify the property but if you had another property within the same class that required validation you would reference the field.
Don't you think this is messy code?
<code>
private string _firstName;
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}
public string LastName { get; set; }
public void Foo()
{
string test = _firstName + LastName;
}
</code>
|
|
|
|
|
I think automatic properties are ugly to start with.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Why not like this?
public void Foo()<br />
{<br />
string test = FirstName + LastName;<br />
}
The fact that there is a field doesn't mean you have to use it...
Robert
|
|
|
|
|
The Microsoft Coding Guidelines says you should use fields internally within a class.
I could be wrong?!?!?
|
|
|
|
|
They are guidelines. Not the law. Judge Dredd isn't going to pay a visit because of this.
|
|
|
|