|
I'm not sure where to begin, but I would say that C# probably isn't the right tool for the job. You're most likely going to have to work with device drivers in C, that'd be my suggestion of where to start looking, at least.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
hi! CP people!!
it's my first time to post a question here, but i tend to consult CP whenever i have programming problems.
my problem here is that i have two textboxes. one is read-only and the other one is not.
now, what i want to do here is to show what the user typed in the textbox which doesnt have the read-only property to the other textbox which is read-only.
i really don't know how to start the coding because it's only been a year since i'm learning C# .NET and my professor in C# doesnt help at all. i can assure you that is not a school project. i just want to learn from you guys rather than to consult my professor.
thanks in advance...
|
|
|
|
|
Hiya,
TextBox textBox1=new TextBox();
textBox1.KeyPress+=new KeyEventHandler(UpdateTextBox);
...
TextBox textBox2=new TextBox();
textBox2.ReadOnly=true;
...
private void UpdateTextBox(object sender,KeyEventArgs e)
{
textBox2.Text=textBox1.Text;
}
Even if textboxes are read-only to the user, .net still can write to it in code.
Hope this will do!
Graham
|
|
|
|
|
it helps logic wise. i tweak the codes a bit but thanks anyways.
Regards...;)
in land of the idiots, the imbecile is the king.
|
|
|
|
|
well u can do like this
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
textBox2.Text=textBox1.Text;
textBox2.ReadOnly=true;
}
it will help u
Yogesh_T
|
|
|
|
|
Hi there!
Please help, I am trying to show the data from an SQL select statement into textboxes.
Here is what I have so far:
SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=CB;Integrated Security=SSPI;");
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM tblCB WHERE CBID='"+ this.CBID.Text +"'", conn);
cmd.ExecuteNonQuery();
conn.Close();
sasa
|
|
|
|
|
Replace:
spatwa wrote: cmd.ExecuteNonQuery();
with:
using (SqlDataReader reader=cmd.ExecuteReader()) {
if (reader.HasRows) {
reader.Read();
textBox.Text=reader.GetString(reader.GetOrdinal("ColumnName"));
}
reader.Close();
}
|
|
|
|
|
Thanks a million Graham, I appreciate your help.
sasa
|
|
|
|
|
just need a little more help with my beginners project, please.
I have a large file in the following CSV format
"71415","535","200","5364564","0","0","0","0","0","0","0","0","0"
I have used the code from this article by dave'O
http://www.codeproject.com/cs/database/DataSetFrmDelimTxt.asp
to place the data in a datagrid.
Just wondering , What is the easiest way to strip out all the quotation marks during the parsing ?
Any help would be appreciated, thanks in advance.
Seem to be having problems as this character is used to denote a string.
|
|
|
|
|
string input=....
input=input.Replace('"','');
Graham
|
|
|
|
|
Thanks for that, my quotation marks are now all gone.
Just a little confused though, does this mean that ' can be used to enclose a string , as well as " . Also does
input=input.Replace('"','');
insert a blank space, or does it remove the character alltogether ?
Thanks for the assistance with this.
|
|
|
|
|
' can only be used to store a single character of type char. E.g.
char testChar='s';
Regarding input=input.Replace('"','');
It takes in a string, returns a new string where all the occurances of the first parameter are replaced by the second parameter. So in this case '"' (representing double quote char) is replaced by '' (empty char).
Graham.
[Edit: Just noticing that it's quite hard to tell two single quotes '' from a double quote " with the default browser's font. ]
-- modified at 17:46 Thursday 15th June, 2006
|
|
|
|
|
Thanks,
" Persistance alone is omnipotent" (Calvin Cooolidge)
|
|
|
|
|
is it possible for me to have hyper terminl running and i retrive any data that is recieved in the hyper termial port??????
or
is it possible for me to run hyper terminal from c# so i can access something through it???
kenny
|
|
|
|
|
Hi,
I want to make an application in C# for Windows XP, which could run in the background and log all the URL visited in any browser by any user.
Any ideas where to start?
Thanks
Code Monkey
-- modified at 18:36 Wednesday 14th June, 2006
|
|
|
|
|
Oh, that could be tricky to implement. Sounds like you need to periodically monitor the processes on the system for any browsers that might start. Perhaps using Process.GetProcesses() .
You would then need to hook into the browser some how, either using a plugin written for the browser, or hooking via the system using via P/Invoke and Win32.
Also this application sounds like it should be implemented as a Windows service, and using some sort of logging mechanism.
Good luck!
Graham.
|
|
|
|
|
Hi
I have main form with a button, which when pressed, displays a second form. I don't want this form modal, so I use Show(). But, I only ever want one instance of this form. My confusion, and I am a real C# / .NET newbie, is when / where / how this is created / destroyed. Here's what I am doing...pseudoish
MainForm.OnClickEvent(...)
{
if secondform == null
secondform = new form(data_for_form_listbox)
secondform.show()
}
secondform.onCloseBUtton(....)
{
Close(); //or should this be hide();//I want the C++ equiv of EndDialog / CloseWindow which will actually delete the instance
}
On the 'secondform' I have a close button, which, calls - 'Close()'. Does that destroy the window? I want it destroyed so my OnClickEvent will create a new instance, so my second form can refresh its data (via the ctor).
I don't need code samples just a basic step by step of where I should create the second form / how I close it, (via teh second form), and should I destroy / recreate etc.
Does this make sense?
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
If i get your problem: you wanna open form2 from form1. and then close form2. using this.close(); is good. it will close form2 but not form1. the next time u call form2 again form form1 everything should be refreshed.
Donkaiser
|
|
|
|
|
Angel1058 wrote: 'Close()'. Does that destroy the window?
If you mean will secondform be a null pointer after it's called, then no. Close() disposes the form and it's contents, and destroys it's window handle, but comparing secondform to null (like you're doing in your OnClickEvent() method) will return false.
You can use the IsDisposed property of the Form to check to see if the form has been disposed, and that should work (but you'd have to check if it's null first)...
if ( secondform == null || secondform.IsDisposed )
secondform = new MyForm(data_for_form_listbox) Hope that helps
“Accept that some days you are the pigeon, and some days you are the statue” -- David Brent
Cheers,
Will H
|
|
|
|
|
secondform.IsDisposed That's what I was missing - many thanks. Amazing, I've used MFC/VC++ for years and years and yet couldn't even successfully close and reopen a form in C#....doh.
Thanks again.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Can we still drag and drop shape onto the form?
I want to draw 8 circles (names Circle) and each one is in an array (Circle #1 = Circle[0]).
How can we do that?
Thank you
Donkaiser
|
|
|
|
|
hi there !
I wrote the following Function , Like this :
private int YourNo(int Number)
{
...
Number=(X+Y)*100;
return Number;
}
I want to use of this function(the value of Number parameter) in this Event :
private void calculate_Click((object sender, EventArgs e)<br />
{<br />
txtNumber.Text=....?<br />
}
in txtNumber.Text I want to put the value of returning function(Number).
How can i use it(Number parameter) ?
thanks a lot
regards,
s_mostafa_h
-- modified at 16:18 Wednesday 14th June, 2006
|
|
|
|
|
Try this:
txtNumber.Text=YourNo(Number).ToString();
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
hi !
it doesn't work . did you test it ?
Regards ,
s_mostafa_h
|
|
|
|
|
No sorry,
It was an idea
What error message you get?
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|