|
|
Is there any other way which can someone send post or get values with C# to PHP and previewing them with PHP in internet explorer??
An 100% solution is to use ProcessStartInfo( "my link&value = ","my data");
And when i'll do a echo $_GET['value'] it returns my data just fine. But the problem is that i have to do with million or billion values.
If i put on and EventHandler which reads from serialport,
Then IE or other browser will opens me million or billion tabs!!! What should i do for this way or propose me something else please???
Thanks
All the truth becomes from knowledge...
|
|
|
|
|
Why don't you collate all this data together and show all of this in a single tab by just sending one echo value.
|
|
|
|
|
I'm reading my data from a device. So i want these values to preview in a website realtime too in a PHP website.
How to do something like that?
Thanks
All the truth becomes from knowledge...
|
|
|
|
|
Why do you want to use a browser for this? What you want to do most of the time is update a value – a web page is not the ideal medium for that. Just use a form with some labels or a table or however you want to visualise the data, and update it whenever you get a new value.
|
|
|
|
|
They want to do something like that. They want to display my data both C# and IE php website realtime too.
All the truth becomes from knowledge...
|
|
|
|
|
Push the data into a database or something else that the website can look at, and have the website auto-refresh its data sections via an AJAX callback.
|
|
|
|
|
Hello everybody!I want to ask you something. I want to send values from C# windows form application in php webpage.In other words send post values from C# to php.
The problem is that php script cannot read this values and preview this results which comes from C# app.Could you help me please?
Here is the C# code:
using System;
using System.Net;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Text;
using System.IO;
namespace WebRequestExample
{
class WebPostRequest
{
public string Post(IDictionary<string, string> objects)
{
WebRequest request = WebRequest.Create("http://127.0.0.1/sensor.php");
request.Method = "POST";
StringBuilder b = new StringBuilder();
foreach (KeyValuePair<string, string> o in objects)
b.Append("?").Append(HttpUtility.UrlEncode(o.Key)).Append("=").Append(HttpUtility.UrlEncode(o.Value ?? ""));
string postData = b.ToString(1, b.Length-1);
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
if (((HttpWebResponse)response).StatusCode != HttpStatusCode.OK)
return null;
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
return responseFromServer;
}
class MainClass
{
public static void Main(string[] args)
{
WebPostRequest a = new WebPostRequest();
IDictionary<string, string> postData = new Dictionary<string, string>();
postData.Add("data", "123156564648989");
Console.WriteLine(a.Post(postData));
Console.ReadLine();
}
}
}
}
And a very simple php script to display the post data!
<?
<pre> print_r($_POST);
echo $_POST['data'];
echo '<br>';
echo $_REQUEST['data'];
echo '<br>';
var_dump( $_REQUEST);
echo '<br>';
echo '<file_get_contents>';
$postdata = trim(file_get_contents('php://input'));
$postdata = urldecode($postdata);
var_dump( $postdata);
echo '<br>';
?>
?>
Could you help me please? I repeat that the problems is that PHP cannot preview the POST data which becomes from C# windows form application. It always returns NULL.
Thanks alot!
All the truth becomes from knowledge...
|
|
|
|
|
I have 20 textBox type objects with parameter Enabled=False, they are named "prog1", "prog2" e.t.c.
And button - Button1; I need on button click set paremeter Enabled=True one by one on each button click. Thanks in advance and sorry for my bad english =)
|
|
|
|
|
Do you mean one button to enable all of them at once?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
no. One by one on every button click.
1. click on a button - prog1.Enabled = True;
2. click on a button - prog2.Enabled = True;
3. click... e.t.c.
Enable all 20 textboxes one by one on every button click.
|
|
|
|
|
Perhaps add them to a list and maintain a counter so you can enable the next one?
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsFormsTestApp
{
public partial class Form1 : Form
{
private List<TextBox> textBoxes;
private int textBoxCounter = 0;
public Form1()
{
InitializeComponent();
textBoxes = new List<TextBox>(new TextBox[]{
textBox1,
textBox2,
textBox3
});
}
private void button1_Click(object sender, EventArgs e)
{
textBoxes[textBoxCounter].Enabled = true;
textBoxCounter++;
if (textBoxCounter == textBoxes.Count)
button1.Enabled = false;
}
}
}
Edit:
If you only need to do this once, a Queue<T> would be better and you won't need the counter:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsFormsTestApp
{
public partial class Form1 : Form
{
private Queue<TextBox> textBoxes;
public Form1()
{
InitializeComponent();
textBoxes = new Queue<TextBox>(new TextBox[]{
textBox1,
textBox2,
textBox3
});
}
private void button1_Click(object sender, EventArgs e)
{
textBoxes.Dequeue().Enabled = true;
button1.Enabled = textBoxes.Count > 0;
}
}
}
modified 10-Jun-12 16:21pm.
|
|
|
|
|
Tried both examples, they don't work with my program, maybe i'm doing something wrong. When i click button nothing happens.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace datori_konf
{
public partial class datoru_konf : Form
{
private Queue<TextBox> textBoxes;
public datoru_konf()
{
InitializeComponent();
textBoxes = new Queue<TextBox>(new TextBox[]{
prog1,
prog2,
prog3,
prog4,
prog5,
prog6,
prog7,
prog8,
prog9,
prog10,
prog11,
prog12,
prog13,
prog14,
prog15,
prog16,
prog17,
prog18,
prog19,
prog20
});
}
private void button4_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
Form2 form = new Form2();
form.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
textBoxes.Dequeue().Enabled = true;
button1.Enabled = textBoxes.Count > 0;
}
}
}
|
|
|
|
|
That looks okay. Did you actually hook up the click event to that method?
|
|
|
|
|
no my mistake, now it works, thanks. Thanks everyone who helped, you are the best 
|
|
|
|
|
i want the project which uses tdbgrid in it....
please guide me....
|
|
|
|
|
Have you tried Google?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
What's a "tdbgrid"? 
|
|
|
|
|
Start reading: TDBGrid[^]
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Just checked the link, looks like I might find it useful for some data display, is this a case of 'gimme code plz being useful'?
|
|
|
|
|
gopalmahadak wrote: i want
You sound my like 4 year old son.
|
|
|
|
|
At our kids say "please"!
|
|
|
|
|
He only says it when he sees something on TV he wants.
|
|
|
|
|
Check on the third party control's website. Im sure you will find a lot of information.
|
|
|
|
|
Hi all, I want to draw the contents of a TableLayoutPanel control on a printer page. When I call Invalidate() of the control, the paint event is not called. The drawing therefore becomes blank. Calling its Refresh() function does not also help.
However, if I call its DrawToBitmap(), the paint event is called. Is there a way I can get the Paint event called so that I can draw on the printer page without creating a Bitmap out of it before? Thanks in advance
|
|
|
|