PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2025 → Faire une fenêtre en CSHARP dans WinDEV avec un Grid (une Table)
Faire une fenêtre en CSHARP dans WinDEV avec un Grid (une Table)
Débuté par AlexisPERR, 22 mai 2025 16:39 - 3 réponses
Membre enregistré
128 messages
Posté le 22 mai 2025 - 16:39
Bonjour,
Comme le dit la doc on peut très facilement faire du code CSHARP dans un pack de procédure globale :

https://doc.pcsoft.fr/fr-FR/?2012008&name=Saisir_du_code_C#

Mais peut-on ouvrir une fenêtre CSHARP ?

Oui, la procédure suivante ouvre une fenêtre C#, il suffit de l'appeler dans un bouton :

using System.Windows.Forms;
PUBLIC static void gcs_make_window_app()
{
Application.Run (new Form ());
}


Si l'on veut mettre un bouton dans une fenêtre, on peut faire comme ceci :

using System.Windows.Forms;
PUBLIC static void gcs_make_window_with_button()
{
Form form1 = new Form();
Button button1 = new Button();
form1.Controls.Add(button1);
form1.Show();
}
Message modifié, 22 mai 2025 - 16:41
Membre enregistré
128 messages
Posté le 22 mai 2025 - 16:46
Mais comment ajouter un champ Table ?

En CSHARP le champ table c'est le Grid

Grid grid1 = new Grid();


Mais il n'est pas reconnu en WinDEV.

a priori il appartient au namespace Controls, mais celui-ci n'existe pas nativement en WinDEV

using System.Windows.Controls;


J'ai beau mettre tous les namespace imaginables, aucun ne connait Grid

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Odbc;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Net.Security;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows;
using System.Windows.Forms;
using System.Xml;


Comment-fait-on pour l'importer dans WinDEV ?
Membre enregistré
949 messages
Posté le 22 mai 2025 - 18:20
allez, je tente une réponse :

public class Grid : System.Windows.Controls.Panel, System.Windows.Markup.IAddChild

https://learn.microsoft.com/fr-fr/dotnet/api/system.windows.controls.grid…

Cdlt
Membre enregistré
128 messages
Posté le 25 mai 2025 - 22:23
merci mais comme j'ai dit Controls n'existe pas dans System.Windows , erreur de compilation :

Error: Error CS0234: The type OR namespace name 'Controls' does not exist IN the namespace 'System.Windows' (are you missing an assembly reference?)


Peut-on importer dans WinDEV les namespaces qui manquent ?