|
This my error :
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.
This line of code is high lighted in the debugger:
if ( ResponseFromDialog != DialogResult.Cancel)
This is my code:
private void button1_Click(object sender, EventArgs e)
{
DialogResult ResponseFromDialog;
// Create an OpenFileDialog object.
openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();
ResponseFromDialog = openFileDialog1.ShowDialog();
// Initialize the OpenFileDialog to look for text files.
// Check if the user selected a file from the OpenFileDialog.
if ( ResponseFromDialog != DialogResult.Cancel)
{
this.Cursor = new Cursor(openFileDialog1.OpenFile());
Input = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
fileReader = new StreamReader(Input );
button1.Enabled = false;
MessageBox.Show("ok here");
ActualData.ParsePositional(openFileDialog1.FileName, Count, GameNumber);
SineWave wave = new SineWave();
wave.run();
}
}
This is my main:
public static void Main(string[] args)
{
Start();
}
Thank you in advance for your help
al
}
|
|
|
|
|
rctriplane wrote: Ensure that your Main function has STAThreadAttribute marked on it.
And have you done this?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi
is it possible to print Crystall repost without see him on screen ?
if yes, how can i do it ?
thank's
|
|
|
|
|
Hi.
I have Windows Vista Ultimate SP1.
My laptop has 4GB Ram.
Windows vista SP1 can use all spaces of the Ram ( I've heard that Vista Sp1 can't use 4GB ) ?
Would appreciate if answer the question.
|
|
|
|
|
Maybe better to ask in the Vista[^] forum?
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Oops , I thought , I'm in the Lounge.
Thanks
|
|
|
|
|
The service pack level doesn't have anything to do with it. It's whether you're using 32-bit Vista or 64-bit.
|
|
|
|
|
Well i have now a Chat P2P ready to work.(for now we need open gateway port manualy).
For get through NAT i want use Hole punching methode that you guy sugested me).
so i read a bit about that and got 3/4 the principe .
now what i want to know is can i send from my chat APP a soket to a php file on a host
(non dedicated).
like i send my soket to port 80 on a host:
http://www.codeproject.com/MySite/SoketListener.PHP
then the file respond me and finaly open my port to other user??
the point of that is i wont let my own computer run 24/24 and do the relais.
I know that i possibly just told a Enorme mistake but for me a soket is a soket and in any langage .
What you sugest me to do for such P2P?
can you clear also my mind also about the Hole Punching process and how open a port.
i don't sea well why if i send soket A - >C B would be able use the same port without being invited to do and since A->C soket sessios has ended?.
|
|
|
|
|
hi guys where can i find punch hole examples in .net or php??
Please help me...I'm coming crazy...
thanks
|
|
|
|
|
There are few prof. that sells out idea how to implement using .net
Are u ready to spend some $ for that?
|
|
|
|
|
suppose input is "zain"
first root will be z and its children will be "a , i , n". then "a" has its children that is "i , n" and "i" has its child that is "n". similarly maintaining the tree by setting root to "a , i , n".
then i am traversing the tree through recursion. i have also check input string " aha" its working. but with long words its throws exp.
|
|
|
|
|
Why are you starting a new thread??
|
|
|
|
|
Because the forums are overrun with people who have no clue ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
No, but honestly, why
Edit: I understand if your question goes unanswered for a couple of days and it was a decent question, but its 6 inches down...
|
|
|
|
|
I had to go back and read his post because I thought he was spawning Thread s for this
Cheers,
Vikram. Current activities:
Films: The classic Pink Panther series
TV series: Friends, season 3
Books: Liar's Poker, by Michael Lewis. Carpe Diem.
|
|
|
|
|
I guess your method of recursion is causing the loop to call itself too many times, OR, longer words expose a bug that causes infinite recursion. So hard to say more without actual code.
It sounds like the number of calls increases exponentially, so option 1 is not off the cards.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
yup its increaing exponentially. thats the code
private void button1_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
lst.Clear();
str.Clear();
dummy = textBox1.Text.ToCharArray() ;
for (int i = 0; i < dummy.Length; i++)
str.Add(dummy[i]);
for (int i = 0; i < str.Count; i++)
{
root = new Node();
first(root);
recursive(root);
addlist(root, null);
char c = str[0];
str.RemoveAt(0);
str.Add(c);
}
lstview(); // adding lst to listview
}
private void addlist(Node current, Node parant)
{
if (current == null)
{
try
{
ch.RemoveAt(ch.Count - 1);
if (parant.NextCousion == null)
{
ch.RemoveAt(ch.Count - 1);
addlist(parant.parant.NextCousion, parant.parant.parant);
}
else
addlist(parant.NextCousion,parant.parant);
}
catch
{
return;
}
return;
}
ch.Add(current.data);
if(current.childerns.Count>0)
addlist(current.childerns[0],current);
if (current.childerns.Count == 0)
{
string s = "";
for (int i = 0; i < ch.Count; i++)
s += ch[i];
if(!lst.Contains(s))
lst.Add(s);
ch.RemoveAt(ch.Count - 1);
}
else
{
try
{
ch.RemoveAt(ch.Count - 1);
}
catch
{
return;
}
addlist(current.NextCousion,current.parant);
}
}
public void recursive(Node current)
{
for (int i = 0; i < str.Count- 1; i++)
layers(current.childerns[i]);
}
public void setingcousion(Node current)
{
int limit = current.childerns.Count;
for (int i = 0; i < limit; i++)
{
if (i == 0)
current.childerns[0].PreCousion = null;
else
{
current.childerns[i].PreCousion = current.childerns[i - 1];
current.childerns[i-1].NextCousion = current.childerns[i];
}
current.childerns[i].parant = current;
}
}
private void layers(Node current)
{
if (current == null)
return;
current.cousions = new List<Node>();
current.childerns = new List<Node>();
for (int i = 0; i < current.parant.childerns.Count ; i++)
{
if (current != current.parant.childerns[i])
{
current.cousions.Add(new Node(current.parant.childerns[i].data));
current.childerns.Add(new Node(current.parant.childerns[i].data));
}
}
for (int i = 0; i < current.childerns.Count; i++)
{
current.childerns[i].parant = current;
current.cousions[i].parant = current.parant;
}
setingcousion(current);
if (current.childerns.Count == 0)
{
layers(current.parant.NextCousion);
return;
}
for (int i = 0; i < current.childerns.Count; i++)
layers(current.childerns[i]);
}
|
|
|
|
|
public void first(Node current)
{
current.parant = null;
current.PreCousion = current.NextCousion = null;
current.childerns = new List<Node>();
current.data = str[0];
for (int i = 1; i < str.Count; i++)
{
if (i == 1)
{
current.childerns.Add(new Node(str[i]));
current.fisrtchild = current.childerns[0];
current.childerns[0].PreCousion = null;
}
else
{
current.childerns.Add(new Node(str[i]));
current.childerns[i - 1].PreCousion = current.childerns[i - 2];
current.childerns[i - 2].NextCousion = current.childerns[i - 1];
}
current.childerns[i - 1].parant = current;
}
}
i know my code is unreadable.
|
|
|
|
|
Hi,
there are 10! / 3! / 3! / 2! = 50400 unique permutations for "statistics".
my 30-line program finds them in 26 milliseconds with a simple recursion, basically without structs, arrays, lists.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
dear sir,
i have developed a software in c#, for reddit.com to automate processes. but i want to use proxy server to connect this site. i have to create one proxy server. but i dont know what is the actually use of proxy server and what is the need and how can i create one proxy server to connect this site.
do u have any idea. please share with me.
Thanks for any suggestion.
yogesh
|
|
|
|
|
yesb.Click += new System.EventHandler(this.Show());
nob.Click += new System.EventHandler(this.Close());
this is the error I keep getting:
An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Show()'
Same thing for this.Close() as well.
I have two buttons, one should reload the application, and the other closes it.
|
|
|
|
|
Interesting
Have you tried pressing TAB twice after writing the +=?
Putting the show/close in those methods may be more.. reliable (as in: no chance that it could go wrong)
|
|
|
|
|
No I haven't. I used this.Close() before and it worked fine.
|
|
|
|
|
Of course it does, but I don't think you're putting it in the right place. If you had pressed tab twice, you would get code like DaveyM69 shows you.
|
|
|
|
|
You can't call Show or Close this way unless you overload the methods i.e
yesb.Click += new EventHandler(Show);
void Show(object sender, EventArgs e)
{
Show();
} The normal way is to have a Click event handler and call Show from there - the same really - just a more logical name.
yesb.Click += new EventHandler(yesb_Click);
void yesb_Click(object sender, EventArgs e)
{
Show();
}
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|