|
Well, I still think the example is poor - and definitely not up to scratch. But thanks for the advice anyway
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Been trying find a way to update a form ( same instance) directly from a class.My example below compiles but the form result leaves the textbox blank.
using the Form1 myform = new Form1 thing works but again leaves the form blank.
Can anyone help? I'm new to this so go easy on me.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace test1
{
public partial class Form1 : Form
{
public string strStringVarible;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
classtest1 clstest = new classtest1();
clstest.external_class();
}
public void accessor_method()
{
this.textBox1.Text = strStringVarible;
this.textBox1.Refresh();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
________________________________________________________
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms.Design;
using System.Data;
namespace test1
{
class classtest1 : Form1
{
public void external_class()
{
this.strStringVarible = "test123";
this.accessor_method();
}
}
}
I'm new so go easy on me please
|
|
|
|
|
Hello,
What you did is:
You have a Form named "Form1" (which derives from System.Windows.Forms.Form).
Than you have a Form named "classtest" (which derives from your Form1).
Hardboiled86 wrote: private void button1_Click(object sender, EventArgs e)
{
classtest1 clstest = new classtest1();
clstest.external_class();
}
At the button Click, you instanciate a new Form (classtest1), which means that now two Forms are in memory (one that you see, and the new second one).
You call the method "external_class" from your second Form, which calls "accessor_method" also from your second Form.
So it should be clear that your first Form, which is visible will not change.
Look at this excellent Article from Colin Angus Mackay[^]
Hope it helps!
All the best,
Martin
|
|
|
|
|
NEVER put such code in forum,only put the code wich u feel having a problem.No one has time to see this kind of stupid stuffs.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Hi
I have to convert the
AVI frames to JPG or BMP
format. Kindly send the C# code
for the same.
Thanking you
Sridharan
|
|
|
|
|
when we want open a file,we have to double click on the file,but Right now,i want open it by command,What must I do?,(note: open file which can see inside of it)
|
|
|
|
|
File.GetAllText ? Hard to know, your question isn't really laid out in a way that makes much sense.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Use StreamReader object to read the content of the file and display it in a window. Also, please make sure that your file may not only contain text data but it can contain picture etc. Hence, if you want to see the real world inside the file you should reading it in binary format and display the records.
Manoj
Never Gives up
|
|
|
|
|
thanks you,I am sorry because I don't display obvious my ideal
After that,I will display my question
when we double click a file,the window of file will display,and we can see the tittle of it(EX: file.txt)
If we use command of C#,what will we do to see the window of file.txt opended ?
|
|
|
|
|
just use Process class.Inside it there one method which takes input as file name and opens it.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
I want to represent telephone directory in this way.
Certainly, anybody may have more phones and each of them must be visible.
It is all dispose in more columns, that economically use working surface.
Table:
TelDirectory (ID,Name,Tel)
PK(ID) - primary key
How to show data like this:
Name1.....Name4
------.....------
Tel11......Tel41
Tel12
Name2
------
Tel21
Tel22
Tel23
Name3
------
Tel31
...
Thanks for any help.
|
|
|
|
|
where are you showing it ? If in a web app, a repeater is your best option.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Then it's up to you to render the results any way you like. No built in control will give the layout you're wanting, however.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
First of all, the ID cannot be a Primary Key as it will not be unique, since anybody can have more than 1 phones.
You can get the list sorted on ID/name of the customer. Once it is sorted it will be esily printed.
Manoj
Never Gives up
|
|
|
|
|
Manoj Kumar Rai wrote: First of all, the ID cannot be a Primary Key as it will not be unique, since anybody can have more than 1 phones.
How does that make ID not unique
1 Colin Mackay 0123 456 7890
2 Colin Mackay 0321 654 0987
Looks fine to me - What did you think was wrong with it?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Ahhh, Ok. Its record ID and not the ID of the person where I thought wrongly. But in either case for the problem we had to print this Unique key do not have any role to play. We have to sort the list on the basis of the Name and get the values printed.
Manoj
Never Gives up
|
|
|
|
|
You posted this exact same question a few days ago. What have you tried since then? Even writing some long, slow, even poor code, to get the job done will give you a starting point. Then post snippets of that code, and the people here will help optimise it.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
It isn't difficult as a table, but I dont know how to displey data on win form in this way. If I get names and phones into dataset, how show them?
How can I provide repetition structure unequal form, that contain name and suitable phones, where all phones are visible?
It seems datagridview isn't proper control to realize that. How else can I do it?
|
|
|
|
|
how can i count the number of words or letters that i used
as an input?
SAMPLE:
\\ input string: mississippi
\\ input search word: i
\\ result: search found 4 occurences of the word 'i'
|
|
|
|
|
If you call string.split and pass in 'i', you can work it out by how many strings it returns.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Or:
string textold= "mississippi";
int countold = textold.Length;
string textnew = textold.Replace("i", "");
int countnew = textnew.Length;
int Found = countold-countnew;
All the best,
Martin
|
|
|
|
|
it didn't work..
what if my "input string" is not constant...
what if i can type any letters or words...
how will it work?
|
|
|
|
|
Sorry, I don't get your point!
Maybe if you show us your code, we could help!
All the best,
Martin
|
|
|
|
|
thanks anyway martin..
i still can't do the code for the program..
it confusing..
|
|
|
|