Comment intégré mon textbox en c#
FRVGH
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
J'aimerais intégré mon textbox a ma commande curl
le textbox dois etre a la place de frank
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private async void Button1_Click(object sender, EventArgs e)
{
string usernameT = username.Text;
string curlCommand = "curl";
string curlArguments = "-X POST https://cloud-dev..fr/ocs/v1.php/cloud/users -d userid=\"Frank\" -d password=\"frankspassword@\" -H \"OCS-APIRequest: true\"";
ExecuteCommand(curlCommand, curlArguments);
}
private void ExecuteCommand(string command, string arguments)
{
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true
};
using (Process process = new Process())
{
process.StartInfo = processStartInfo;
process.Start();
process.StandardInput.WriteLine($"{command} {arguments}");
process.StandardInput.Flush();
process.StandardInput.Close();
string output = process.StandardOutput.ReadToEnd();
string errors = process.StandardError.ReadToEnd();
process.WaitForExit();
if (string.IsNullOrWhiteSpace(errors))
{
MessageBox.Show("Sortie de la commande : " + output, "Commande exécutée avec succès");
}
else
{
// MessageBox.Show("Erreurs : " + errors, "Erreur lors de l'exécution de la commande");
}
}
}
}
}
Je vous remercie beaucoup pour votre aide .
Windows / Firefox 115.0
A voir également:
- Comment intégré mon textbox en c#
- Que veut dire achat intégré - Guide
- Tv lg tnt intégré problème - Guide
- Comment intégrer une vidéo dans un powerpoint - Guide
- Tableau d'équivalence circuit intégré pdf - Forum Matériel & Système
- Tv tcl tnt intégré - Forum TV & Vidéo
1 réponse
Bonjour
regarde du côté des différentes méthode de concanténation de chaines
- string.format
- stringbuilder
- interpolation de chaine
- etc
A noter tout de même que la concaténation est une notion de base dans n'importe quelle language, qu'il aurait fallu apprendre avant de te lancer dans une application complexe