|
Iam using two forms in a windows appln. How can I access the control of the second form from the first form.
Thank you
|
|
|
|
|
2 options really.
1) Expose the whole control as a property of form 2.
on form2:
public TextBox TextBox
{
get{ return this.textBox; }
}
then in form1:
Form2 form2 = new Form2();<br />
form2.TextBox.Text = "Hello World";
2) Expose just that functionality that you need, without exposing the whole control (this way is arguably preferable)
on form2:
public string SomeTextBoxInfo
{
get{ return this.textBox.Text; }
set{ this.textBox.Text = value
}
then in form1:
Form2 form2 = new Form2();<br />
form2.SomeTextBoxInfo = "Hello World";
|
|
|
|
|
Hello,
This[^] is the answere, from Colin!
All the best,
Martin
|
|
|
|
|
Hi,
after created a good serial number generator, and found the way to use my serial with the msi setup project... I'd like to store the serial number (when possible in a file)....
How can I do????
|
|
|
|
|
|
LoL... Sorry!
I didn't get the notification e-mail! It was exactly what I was looking for, but now we decided to go on another philosophy and check the Serial Number every time the program gets started.
Anyway, that helped me a lot finding the answer to my last question.
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
hi i am working on a project under which i have to store a image in access database i know that the data type of the access variable must be ole object
unfortunately i dont have an idea abt storing it. i know that this question is suited for ado.net forum but i hope you guys will help me even a glimps of the c# code will be helpfull
sindhu tiwari
its me sid
|
|
|
|
|
Save the image to a MemoryStream and use the ToArray method to get the data as a byte array. The byte array can be saved in the database field.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
thanks for the code but at run time a error is thrown saying
""'"Data type mismatch in criteria expression."'''"
if u have any idea abt this error please let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
sindhutiwari wrote: thanks for the code
I didn't provide any code.
sindhutiwari wrote: at run time a error is thrown saying
""'"Data type mismatch in criteria expression."'''"
That is an error message from the database that tells you that your SQL query is invalid.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
This should get you started:
private byte[] ConvertImage(Bitmap image, ImageFormat format)
{
if (image == null)
throw new ArgumentNullException("image");
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, format);
return ms.ToArray();
}
} The ImageFormat parameter just tells you what format the image is that you want to save, e.g. Jpeg or Png.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks for the code but at run time a error is thrown saying
""'"Data type mismatch in criteria expression."'''"
if u have any idea abt this error please let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
Use the debugger, step through the code and see where the exception is thrown.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i dont have any idea abt the debugger step if u dont mind plz tell me
its me sid
|
|
|
|
|
sindhutiwari wrote: i dont have any idea abt the debugger step if u dont mind plz tell me
How can you be coding without knowing how to debug? There's a honking great menu in Visual Studio called Debug. Have a look at what it offers you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
no problem in that.................
its me sid
|
|
|
|
|
My outlook add in is not loading in PC other than development PC.I tried all above points but still didn't succeed
1) Load behaviour is remain 3 after open outlook
2) In CAS add in has full trust rights
3) There is no error while opening outlook from commnad prompt after execute command set VSTO_SUPPRESSDISPLAYALERTS=0
All points that casue of error are OK but still not working
Please help me
Pritesh Patel
|
|
|
|
|
Hi everyone,
i have a treeview and a sqlserver table called companies. with company id, name, adress, and departments. I have the following code to set the company names in the treeviewnodes:
foreach (DataRow mydr in Sql.mydt.Rows)
{
treeView1.Nodes.Add(new TreeNode(mydr["Dep_comp_name"].ToString()));
}
now how can i set the departments(belonged to the company names) as childnodes to the companyname nodes ?
thanx.
|
|
|
|
|
Retain a reference to each TreeNode object that represents a company after it is created. Call the Nodes.Add method of that object for every department in the company.
Paul Marfleet
|
|
|
|
|
hi paul marfleet,
thanx for your response. i m very new in c# and i still don't understnad how to do that. cause one company can have more departments, how can i get those departments and set it to the node of the right company? Can u give me some code?
|
|
|
|
|
I'm not going to do your (home)work for you. If you want to learn C# or programming as a general discipline, you need to practice solving problems. Since my first post, you haven't demonstrated that you have made any further effort to solve the problem yourself.
I will give you some further pointers though.
1. Fetch your data in a fashion that allows you to easily iterate through i) companies ii) departments within companies
2. When iterating through companies, use a nested loop to iterate through the departments for a company.
3. Retain a reference to each company treenode you add to the tree in an object variable. Add your department nodes as children to each company treenode when iterating through departments for a company.
Paul Marfleet
|
|
|
|
|
As an example:
foreach (DataRow mydr in Sql.mydt.Rows)
{
TreeNode parent = new TreeNode(mydr["Dep_comp_name"].ToString());
parent.Nodes.Add(new TreeNode(mychilddr[...].ToString()));
treeView1.Nodes.Add(parent);
} This is an inefficient approach, but until you become more proficient it should help you. The important thing is that you will have to get the child rows from the database somehow, and add them to the Nodes collection of the company tree node.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon,
Thank you, geat help. this helped me a lot.
|
|
|
|
|
I have a web application written using C# (visual studio 2002) which including the use of resource (only string data) but when I tried to edit the data displayed on the web page in the resource created...it makes no changes to the page when I refreshed it (or even after clearing the cache,etc). May I know how actually I can change the data so that it will reflect the changes to my web page as well? Please HELP...
Thanks in advance!
Alexia
|
|
|
|
|
I used a text file and just included the text file inside the web page by using
<!--#include virtual="/maincontent.txt"--><br>
inside the HTML code
Your resource shouldnt really matter as long as the page can access it. Check your resource and make sure it is updated properly (before the page reads it) and that all permissions are set correctly. The page will have to be refreshed too.
Hope this helps
I love programming!
|
|
|
|