|
i want to transfer data between two form automatic two way, and response by click a button too. Sory because my English is not goog, i'm come from Viet Nam, i'm learning C# my self. This my first time post a Question.
|
|
|
|
|
Promance wrote: want to transfer data between two form automatic two way, and response by click a button too. Hi Promance,
Then it sounds to me like you want ... at all times ... for the exact same content to appear on both forms ... yes ? That's "synchronization."
And, if you have synchronization working, then why would you also need to have a button to press to make sure the content was synchronized ?
Please describe more clearly the nature of the data you are synchronizing here:
1. is it only text characters: example: you want a textbox on Form1 to always display the same text as a textbox on Form2, and the reverse.
2. or, is the data "more than that" ? does the data include content which you interpret and then construct controls based on your interpretation ?
And, finally, it would be helpful to clearly describe the source of the data:
1. by direct action of a user while your application is running: like typing in a text box
2. by making calls to some external database and getting new data ... or does some external source notify your application there is new data needed to be used ?
Give us a brief description of what's on Form1 and Form2?: what kind of controls ? Custom controls from 3rd. party companies, Excel used via VSTO, a UserControl you created yourself, standard Visual Studio toolbox controls ?
best, Bill
good luck, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
It don't need complicated as you say. First, i want a textbox on Form1 to always display the same text as a textbox on Form2 when i press a letter key. Second, i have a project about File Explore in Windows, when i want to rename a folder or a file(i have used ListView to show file and folder), i must be add a form named Rename. And i'm stuck here, i can rename file, but can't update file's name in ListView or TreeView.
|
|
|
|
|
there is three solution:
1、pipe.
2、shared memory.
3、Message.
|
|
|
|
|
You use anti-tank missles to kill mosquitoes don't you?
|
|
|
|
|
|
I am converting from PHP to C# and I might be doing this completely wrong but here goes. I am reading rows from a database with a reader. Then using a foreach command I am walking through the records creating an object and then adding the object to a List<t>. I then return the list to be used for other purposes. But since the object that I am adding to the List is sent by reference it ends up filling the list with the values of the last object added. I am looking for advice on alternate was to fill the List or alternate ways to use the objects. Please try to refrain from just telling me I am and idiot. Be assured I am already aware of this fact. Thanks to anyone that can offer advice. Below is some of the code. I hope that I posted it OK.
Mark
public object find_by_sql(string sql_statement, Type object_type, database working_database)
{
working_database.reader = (SqlDataReader)working_database.query(sql_statement);
object defined_object = Activator.CreateInstance(object_type);
List<object> object_array = new List<object>();
while (working_database.reader.Read())
{
Console.WriteLine("Calling Instantiation");
object_array.Add(instantiate(working_database.reader, defined_object));
Console.WriteLine("object test = " + defined_object.GetType().GetField("descr").GetValue(defined_object).ToString());
Console.WriteLine("Returned from Instantiation");
}
return (object_array);
}
private static object instantiate(SqlDataReader records,object defined_object)
{
for (int i = 0; i < (records.FieldCount); i++)
{
int one = (int)records.GetInt32(0);
string two = (string)records.GetName(i);
var three = records[i];
Console.WriteLine("{0} : {1} - {2}", one, two, three);
defined_object.GetType().GetField(two).SetValue(defined_object, three);
}
return(defined_object);
}
|
|
|
|
|
When you read N rows from a database and want all of it stored in some collection such as a List, you obviously need N objects to store all the data; so it takes a new or a CreateInstance or some such inside the loop, you just can't reuse a single object over and over.
|
|
|
|
|
please tell me any job for Asp.net in indore.
shubham vijay
|
|
|
|
|
This is [a] forum for programming questions on C# and .NET. Try this[^] site if you're looking for a job in Indore.
/ravi
modified 11-May-12 15:26pm.
|
|
|
|
|
I have an XML document that contains in one element XHTML fragments, specifically one or more p tags, which can contain further XHTML tags such as em, span etc. These are all in an "xhtml" namespace, and the XSD has imported the XHTML strict schema, so all is fine in that regard. My problem is this:
My application needs to display these XHTML paragraphs as a read-only document. My thought was to wrap these in an XHTML document with a namespace specified on the body tag, like this:
<!--
<html>
<head>
<meta http-equiv="content-type"
content="application/xhtml+xml;charset=utf-16" />
</head>
<body xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!--
<xhtml:p>Namespaced paragraph from XML</xhtml:p>
<xhtml:p>A partly <xhtml:em>italicised</xhtml:em> paragraph from XML</xhtml:p>
<!--
</body>
</html>
This way, I wouldn't have to remove all namespaces from the XHTML elements when putting the document together.
When I give this generated document to the System.Windows.Forms.WebBrowser control (.NET 3.0), the two paragraphs flow together and the em is ignored (the same thing occurs in IE8). In other words, the WebBrowser doesn't unserstand the namespace, and treats xhtml:p as an unknown element and ignores it.
In Firefox, however, the two paragraphs FF they are on separate lines with normal paragraph distance, which is what I expected.
I'm curious from a purely academic point of view whether Firefox or IE8 is in the right here, but am more interested in a pragmatic solution to this problem, if one exists.
|
|
|
|
|
Hi,
I am studying the following control :
C# Custom Control Featuring a Collapsible Panel[^]
I would like to rewrite that control for the 4.0 framework.
This control consists of a headerpanel and in that headerpanel are 2 pictureboxes. When I study the CollapsiblePanel.Designer.cs file I see that the component designer added the parent child relations through Controls.Add statements. How can I achieve this relation through use of the designer. When I drag the panel and picturebox controls on the designer surface the controls get just created an no relation gets added.
|
|
|
|
|
All you do is drop the child control inside the bounds of the parent control. That's it!
|
|
|
|
|
If you are using a custom control (i.e., a UserControl), and you've placed an instance of it on the design-surface at design-time, it will not exhibit the behavior of other native C# container controls: where drag-dropping another control ... from the ToolBox ... into the container automatically makes the dropped control a child of the container.
Look for an article here on CP by Henry Minute explaining how to enable this "swallow dropped controls and make them children of the container" for custom controls used at design-time, and look for comments by me here on CP, suggesting the possibility of a simpler solution.
best, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
I have a win form that you can click a browse button - navigate to your image file - and view the image in the win form. I've been trying to associate my progress bar to the load time of the image selected with no success. Can anyone take a look at my code and see what I'm missing?
private void startButton_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.FileName = "";
open.Filter = "Image Files(*.tif; *.jpg; *.jpeg; *.gif; *.bmp)|*.tif; *.jpg; *.jpeg; *.gif; *.bmp";
open.InitialDirectory = @"g:\All Scanned Jobs\";
if (open.ShowDialog() != DialogResult.Cancel)
{
pictureBox1.Image = new Bitmap(open.FileName);
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox1.WaitOnLoad = false;
pictureBox1.LoadAsync(open.FileName);
}
}
void pictureBox1_LoadProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
|
|
|
|
|
make sure the pictureBox1_LoadProgressChanged method is associated with the pictureBox event, i tested your code here and it works without modifications, have you tried to put a breakpoint into the pictureBox1_LoadProgressChanged method?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
I have this in my Form1.Designer.cs code.
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.BackColor = System.Drawing.SystemColors.ButtonFace;
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.ImageLocation = "";
this.pictureBox1.Location = new System.Drawing.Point(13, 71);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1303, 701);
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
this.pictureBox1.LoadProgressChanged +=new System.ComponentModel.ProgressChangedEventHandler(pictureBox1_LoadProgressChanged);
Is that where it needs to be?
|
|
|
|
|
your code are exactly the same as mine, still, works fine, the image loads pretty fast, so the progressbar moves fast, but stops at 100% you said that a breakpoint don't helped, what was the behavior? the method isn't being called? the image isn't loading?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
The break gives me this:
ImageViewer.exe!ImageViewer.Form1.pictureBox1_LoadProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e) Line 71 + 0x5 bytes C#
ImageViewer.exe!ImageViewer.Program.Main() Line 18 + 0x1d bytes C#
I'm using 2010 Express of visual studio would that have anything to do with it?
|
|
|
|
|
And everything works just fine except I do not see the progress bar fill up at all and once the image is done loading completely I still dont see any green.
|
|
|
|
|
And a breakpoint didn't come up with much help.
|
|
|
|
|
Did you set the Maximum on the progress bar to be something sensible?
|
|
|
|
|
I have the Min set to 0 and the Max set to 100.
|
|
|
|
|
Member 8956301 wrote: pictureBox1.Image = new Bitmap(open.FileName);
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox1.WaitOnLoad = false;
pictureBox1.LoadAsync(open.FileName);
OK, let's break this code down line by line
1) Open the file, create a bitmap and set as the picturebox image
2) Set size mode
3) tell picturebox that future image loading will be async
4) Do async load from the file, this is now reloading
So you are loading the image twice.
I think all you need is
pictureBox1.WaitOnLoad = false;
pictureBox1.LoadAsync(open.FileName);
Alan.
|
|
|
|
|
Thanks for catching that for me. I've made that corrections but the progress bar still does nothing.
|
|
|
|
|