|
i'm not shure how to go about writing the code for this i need help!!!!!!!
it has 2 group boxes,,,, ,groupbox 1 has name and message labels in it as well as 2 text boxes,
groupbox 2 is directley under groupbox 1,groupbox 2 is labeled (color)
it has 4 radio buttons with red,green, blue ,and black.
it also has a picture box at the lower left corner. and 2 more labels 1 under the pic box and the other to the right of the pic box
|
|
|
|
|
what is the question?
MCAD
|
|
|
|
|
i'm just starting to use c# i'm not shure how to start the code . i know what it should look like but not shure how to put into code...
any help would be apprciated
|
|
|
|
|
Hi,
I am writing an application that needs to "take over" another window that runs a streaming data. I mean, I have a streamer, which shows some data on the screen, and I need to write a program that can read this data from the screen, analyze certain things and then press some buttons on this streamer. My prefference was really to write this in java,(can be in C# though) but I can't find a way or direction as to how I can read or control another application window. Does anyone can please show me at least a hint or refference ? I might add that this should run under windows XP and with administrator authorizations.
Thanks.
|
|
|
|
|
If i understood you correctly you want to achive two things First make two application communicate with each other.Second make one appliaction press buttons in another application if this correct for first use one of Inter-Process Communication like remoting,winsockets...
look at Threads[^]
for the seconed you can achive it using SendMessage windows api an example you can found it Click Buttons in another apllication[^]
second way you can define your custom protocol so let one application to send message to another to call specific method
MCAD
|
|
|
|
|
Hi all
I'm trying to implement a form that can only display one instance at a time. Note that this isn't the first form of the application - I'm not trying to build a single instance app. I just want one of the forms to display only once when a button on the form called at startup is clicked. I've got this working for the most part by implementing it as a singleton but run into problems when the form is closed and I try to open it by clicking the button again. The code I'm using is:
public partial class Singleton : Form
{
private static Singleton instance = null;
private Singleton()
{
InitializeComponent();
}
public static Singleton Instance
{
get
{
if (instance == null)
{
instance = new Singleton();
}
return instance;
}
}
~ Singleton()
{
instance = null;
}
}
I was under the impression that the destructor would resolve the issue I'm having but it hasn't. I receive the following exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Singleton'.
Could anyone suggest how I can resolve this issue or suggest another approach to a single instance form that can be launched and closed more than once from the main form of the app?
Thanks in advance
MrR_
Nothing is foolproof to the talented fool.
|
|
|
|
|
A possible solution would be to create the form at startup, and only Show() /Hide() . When the button is pressed, Show() , and attach to the Form.Closing event and instead of destroying the form, simply Hide() it.
|
|
|
|
|
May this help
public class SingletonForm : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
private static SingletonForm formInstance;
public SingletonForm()
{
InitializeComponent();
}
public static SingletonForm GetInstance()
{
if(formInstance!=null)
return formInstance;
else
return (formInstance =new SingletonForm());
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "SingletonForm";
}
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel=true;
this.Hide();
}
}
look at Singleton Pattern[^]
MCAD
|
|
|
|
|
Hi again
Thanks for the tips so far. I'd actually come across those myself but I want to do a lot of work when the form opens and closes that hide introduces problems for. I'll admit that I can probably work around this with a lot of effort. I was just hoping there might be an elegant solution.
Thanks
MrR_
Nothing is foolproof to the talented fool.
|
|
|
|
|
Hi all,
I'm making a little dictionary program in C# for experimenting purposes. everything is coming along fine except how to select the word that is currently under the mouse when the user presses.
in VB6 it was done through an API as i remember, but i don't recall which, but this shold be a .net framework program, so better without any win32 api
Thanks in advance
|
|
|
|
|
If You use RichTextBox you can use GetCharIndexFromPosition to get the word
this simple example
private string GetWordFromPos(Point p)
{
string word;
int cIdx=richTextBox1.GetCharIndexFromPosition(p);
int startPos;
for(startPos=cIdx;startPos>0;startPos--)
{
string c=richTextBox1.Text.Substring(startPos-1,1);
if(c == " ")
break;
}
word=richTextBox1.Text.Substring(startPos,cIdx-startPos);
for(startPos=cIdx;startPos<richTextBox1.Text.Length;startPos++)
{
string c=richTextBox1.Text.Substring(startPos,1);
if(c == " ")
break;
}
word+=richTextBox1.Text.Substring(cIdx,startPos-cIdx);
return word;
}
private void richTextBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
Point p=new Point(e.X,e.Y);
String word=GetWordFromPos(p);
Debug.WriteLine(word);
}
If you use TextBox then TextBox didn't have equivalent method or as i know so you need to use SendMessage Windows API to Function to send EM_CHARFROMPOS to get the index of the Char and Modify the previous function to take to get the text for more inf o look at
EM_CHARFROMPOS Message [^]
MCAD
-- modified at 22:30 Tuesday 13th September, 2005
|
|
|
|
|
The problem is, I want to use this function on the text in other windows, not in my program. and i can't be sure if it'll be a rich textbox, textbox, label or any other control that will be read.
I read the "EM_CHARFROMPOS Message" but it makes little sense to me. high word, low word... it all doesn't sound the c# level. was that in the C++ time?
|
|
|
|
|
hi all
i need help from all of u. i need tested source code to export data from datageid to excellsheet. hoe i do that
ashish
|
|
|
|
|
|
the problem is:
I want to use the method "system("PAUSE");" in C#, but I cannot find which namespace it blog to?
Can you help me??
shanzy
|
|
|
|
|
Do you maybe want System.Threading.Thread.CurrentThread.Sleep() ?
|
|
|
|
|
Thank you for your answer,but I .....
I just want to know how to use the method "system("PAUSE");" in C#
just like in C/C++:
int main()
{
....
system("PAUSE"); //must using this function
....
}
How do this thing in C# ???
shanzy
|
|
|
|
|
You could also do this:
Console.WriteLine("Press Enter to continue...");
Console.ReadLine(); -- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Thank you for your replay!
I can use the method system() like this:
system("cmd.exe");
but I can't use the method:
Console.ReadLine();
----------------------------
So If I must using the method "system();" , how to do it??
shanzy
|
|
|
|
|
|
Thank you very much, I got it
And thank you all friends
shanzy
|
|
|
|
|
hi, how can i find the date in the HTML Response string?
.....
13.09.2005
......
somth. goes wrong here:
<br />
Regex regex = new Regex(@"^([0-9]{1,2}).([0-9]{1,2}).([0-9]{4,4})$");<br />
Match m = regex.Match(HTMLResponseString);<br />
if(m.Success)<br />
{<br />
MessageBox.Show("found");<br />
}<br />
cu
|
|
|
|
|
what about
(?<Month>\d{1,2})[\./](?<Day>\d{1,2})[\./](?<Year>(?:\d{4}|\d{2}))
regards
-- modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
i use:
<br />
Regex regex = new Regex(@"(?<Day>\d{1,2})[\./](?<Month>\d{1,2})[\./](?<Year>(?:\d{4}|\d{2}))");<br />
perfect, where do you know the pattern <month> ?
but i dont want to recognize: 05/19/14 only like that: 13.09.2005
cu
|
|
|
|
|
and how can i recognize a date like:
13 Sep 2005
or
14 Okt 2006
or
07 Nov 2005
what about:
<br />
"(?\d{1,2})[\ /](?\w{3})[\ /](?(?:\d{4}|\d{2}))"<br />
cu
|
|
|
|