|
After receive some instructions, now I can do what I want.
--------------------
class Form2 : Form
{
public Form1 form1;
...
--------------------
class Form1 : Form
{
...
void Form1_Load(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.form1 = this;
form2.Show(); //form2.ShowDialog is still OK
}
...
}
And then we can use "form1" with every methods, properties or controls in Form1 that Form2 have permission to access.
Reference:
http://searchvb.techtarget.com/vsnetATEAnswers/0,293820,sid8_gci875271_tax293474,00.html[^]
|
|
|
|
|
hi,
I would like to find some examples for making draggable toolbar, and so that it can dock to some where.
anyone can give me some hints? thanks
|
|
|
|
|
HI!
There are quite a few articles here on the topic, you might want to use the search function.
One of them is here[^]
Regards,
mav
|
|
|
|
|
Can you help me?
hope for help
|
|
|
|
|
WindowState = Maximized and no bitle bar
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Just set your Form 's FormBorderStyle to None and resize your form to match the size of the screen. The screen size can be retrieved using the System.Windows.Forms.Screen class.
Regards,
mav
|
|
|
|
|
I have two windows forms. In the first form I am trying to call a method from the second form. I have created an instance for the second form but it will not let me access the method unless i change it to static but if I change it to static the other calls to controls in that form don't work.
Form 1:
Form frm2 = new Form2();
...
...
frm2.SetupScreen();
Form 2:
public void SetupScreen()
{
this.richtextBox1.Text = "";
......
}
Can someone please help me with this?
|
|
|
|
|
|
I found the problem.
I used:
Form frm2 = new Form2();
I should of used:
Form2 frm2 = new Form2();
|
|
|
|
|
DateTimePicker ...How to take it null when binding it to a datetime field?
I have an Customers table (ID,Name,BirthDay(datetime))
and I use DatetimePicker to bind with BirthDay...
and when I don't know the birthday of some Customers ,so I want its value is null....Can you help me????thank you so much...
The man with nothing to lose
|
|
|
|
|
The default Windows.Forms.DateTimePicker cannot be empty.
Search the articles for "nullable datetime", all you'll find better DateTimePickers, like this one[^] or that one[^]
_________________________________
Please inform me about my English mistakes, I still try to learn your language!
|
|
|
|
|
Hi Khanh,
istead of DateTimePicker.Value = null use DateTimePicker.Value = System.DBNull.Value
Hope that helps
GanDad
|
|
|
|
|
How to create expression column named Age from the existing column BirhtDate?
Sorry for bad English.
Thank You.
|
|
|
|
|
int Age = DateTime.Now.Year - birthDate.Year;
What do you mean by 'expression column' ? You want to show this in a datagrid ? Then you need a column that binds to a function that calls the above code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, Sir.
I mean...
DataColumn c = new DataColumn();
c.Expression = "BirhtDate - DateTime.Now";
Is it possible to create a column like I mean above?
Thank You.
|
|
|
|
|
Well, that expression is wrong, but the answer is I don't know if it can be done directly, I doubt it very much. The Expression needs to be SQL. Actually, SQL Server has a Now property, or something along those lines, I wonder if that would work ?
Try DATEDIFF('yyyy', BirthDate, GetDate()). If that doesn't work, then I'd say nothing will. You definately cannot use C#, you need to use SQL if you do it this way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi, there is error ina parameter int that SQL function.. the 1st parameter should b DATEDIFF(year,birthday,Getdate())..or DATEDIFF(yyyy,birthday,Getdate()) but the 1st is more accurate i think. that would work as an expression for a column in ur table as it returns only one value
IF u need help...Help the others
|
|
|
|
|
when I bind a dataset to a datagrid (I did it so many times and they always run well but sometimes I meet some mistakes with the same code ...I think that because my database...):
I bind datagrid with a dataset ...and then I use bindingManagerBase.position to move next and pre ,that's normal but when I press the button AddNew(using BindingManagerBase.AddNew()) .It make a new row in datagrid but the cursor don't move to the new row ( It should move when I use the same code in another window form ,it run so well...) and then I can't move Last(after I add a new row in datagrid)...
I don't know why the same code but it takes various result....Could you please to help me?...I must complete this project soon...Thanks first....
The man with nothing to lose
|
|
|
|
|
How to convert bytes in bitmap code
|
|
|
|
|
My image processing code shows you how, basically you need to create the bitmap first, then stuff your bytes into it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How to convert bitmap in bytes code?
|
|
|
|
|
Damn, didn't I just answer this ?
If you want the answer in C# to both this and the question above, read my image processing articles on this site. I've already answered this in C++ today, I assume it was you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have an app which is going to use an image library. I'd like to put the library into a DLL which exposes a hashtable, where the names of the images are the keys, and the images are the values. Then I can use the Keys property to get the names for a drop list, and pass the selected names back to get an image.
The thing is, I want to be able to change this dll and replace it without changing the exe. From what I've seen, I think that the compiler binds to the DLL so that if I change it, I need to rebuild. Is there a way of late binding to a dll so that I can do what I want ? Or will it just work and I'm worried about nothing ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Or will it just work and I'm worried about nothing
It may work,as the clr compiles it at run time ,so it will use that resources when the exe is executed ,AS I THINK
|
|
|
|
|
Yeah, it seems possible, the stuff I've had trouble with is COM based, which is a whole different thing.
Christian Graus - Microsoft MVP - C++
|
|
|
|