logo
down
shadow

How to know if the Form App open or not c#


How to know if the Form App open or not c#

By : NorthHighlander
Date : January 02 2021, 06:48 AM
this one helps. You can check if a form of a given type is open in your application like this (using LINQ):
code :


Share : facebook icon twitter icon
Can a Timer from a open form interupt code on other open form

Can a Timer from a open form interupt code on other open form


By : intelceptor
Date : March 29 2020, 07:55 AM
it should still fix some issue No. The WinForm framework operates on a single thread. Therefore, if Form2 is currently executing a database command, the UI thread will be busy until that command is complete. No other UI activity will be processed until the thread is free to do so. You could use a System.Timers.Timer or System.Threading.Timer instead, since those operate on a separate thread, however, if the purpose of the timer is to modify the UI in some way, such as showing status or progress, then the changes to the UI will not occur until the UI thread is free, anyway. The best way to handle these kinds of situations it to, instead, do the time-intensive work on a separate thread so that the UI thread is free while the work is being done. The easiest way to do that in a form is by using the BackgroundWorker component. It's a component, so you can drag one onto your form from the form designer tool box.
Passing information from an open form to an open form on TextChanged event

Passing information from an open form to an open form on TextChanged event


By : Niru Tamang
Date : March 29 2020, 07:55 AM
wish helps you I'm not sure if got your question right. I assume you want to pass information from one child-form to another.
One way of doing that would be like this:
code :
public interface IDataContainer
{
     void SetData(String data);
}
public partial class parentForm : Form, IDataContainer
public partial class parentForm : Form, IDataContainer
[...]

public void SetData(String dataComingFromOtherSource)
{
     this.browserFormInstance.passInfo = dataComingFromOtherSource;
}
[...]
public partial class parentForm : Form
{
    private notesForm notesForm = null;

    public parentForm()
    {
        InitializeComponent();

        // Note that at this point you are instantiating
        // the child-form and you are passing a reference
        // to the `parentForm` so that you can pass information
        // to it, and from it to whatever other form you may
        // need, in an elegant way.
        this.notesForm = new notesForm(this);
    }
public partial class notesForm : DockContent
{
    // On runtime this will in fact the `parentForm` object instance.
    IDataContainer myDataContainerInstance = null;

    public notesForm(IDataContainer myDataContainerInstance) : base()
    {
        InitializeComponent();

        // Assign the reference so that you can use it later
        this.myDataContainerInstance = myDataContainerInstance;

        textBox1.TextChanged += new EventHandler(textBox1_TextChanged);
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        this.myDataContainerInstance.SetData(textBox1.Text);
    }
}
Budget Analysis Form Rightside grid should defaultly open when i Open the form for single project. Dynamics ax

Budget Analysis Form Rightside grid should defaultly open when i Open the form for single project. Dynamics ax


By : Fernando González
Date : March 29 2020, 07:55 AM
hope this fix your issue I would suggest the following two changes for version AX 2012 R3. I would guess that this would also work in other AX 2012 versions. I could not find any budget analysis in AX 2009 and I doubt it exists there because it is part of the retail module which has been introduced in AX 2012.
First, customize the building of the tree control such that the first child will get selected instead of the root. To do that, customize method initTreeControl of class BudgetAnalysisInquiryHelper_PSN and add the following line after the tree has been expanded:
code :
_formTreeControl.select(_formTreeControl.getChild(_formTreeControl.getRoot()));
selectedNode = ctrlDimensionTree.getItem(ctrlDimensionTree.getSelection());
budgetAnalysisDimensionNode = selectedNode.data();
ctrlSelectedNode.text(budgetAnalysisDimensionNode.getNodeText());
element.getBudgetSummary(ctrlDimensionTree);
Button click to open new form and don't open if already have active form running

Button click to open new form and don't open if already have active form running


By : psT
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Either use ShowDialog and make it modal
Or use the reference reference to wizard or a bool flag to make the check. Make sure if you use a reference to set it null afterwards
code :
bool isOpen;

...

public void click()
{     
    if (!isOpen)
    {
        // do something
        wizard = new Wizard();
        wizard.Closing += (sender, args) =>
                            {
                                isOpen = false;
                            };
        isOpen = true;
        wizard.Show();
    }
...
Enabled = false; 
Import registration form as a selection in program list, and close form when finished; when I return to open form again,

Import registration form as a selection in program list, and close form when finished; when I return to open form again,


By : user2626049
Date : March 29 2020, 07:55 AM
hope this fix your issue I want to open a form that is represented in a register file that is opened by a click in register button in the login window (main.py) but when the registration form is closed, it can not be opened again in the same session. , Try it:
code :
from PyQt5.QtCore    import *
from PyQt5.QtGui     import *
from PyQt5.QtWidgets import *

class window(QDialog):           
    def __init__(self):
        super().__init__()
        self.initWin()

    def initWin(self):
        self.gridLayoutCreation()
        vBoxLayout = QVBoxLayout()
        vBoxLayout.addWidget(self.groupBox)
        self.setLayout(vBoxLayout)
# ---       self.show()

    def gridLayoutCreation(self):
        self.groupBox = QGroupBox('')
        gridLayout = QGridLayout()
        qutBtn = QPushButton('Exit')
        gridLayout.addWidget(qutBtn, 0, 0)
        qutBtn.clicked.connect(self.qut)
        self.groupBox.setLayout(gridLayout)

    def qut(self):
        self.close()



class MainWindow(QMainWindow):
    count = 0

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.mdi = QMdiArea()
        self.setCentralWidget(self.mdi)
        bar  = self.menuBar()
        file = bar.addMenu("File")
        file.addAction("New")
        file.addAction("cascade")
        file.addAction("Tiled")
        file.triggered[QAction].connect(self.openRegister)

    def openRegister(self, q):
        print("triggered-> q ->", q.text())
        if q.text() == "New":
            MainWindow.count = MainWindow.count+1
            sub = QMdiSubWindow()
            sub.setAttribute(Qt.WA_DeleteOnClose)
            sub.setWidget(window())                                # <---                                  
            sub.setWindowTitle("subwindow"+str(MainWindow.count))
            sub.setGeometry(100, 100, 400, 400)
            self.mdi.addSubWindow(sub)
            sub.show()

        if q.text() == "cascade":
            self.mdi.cascadeSubWindows()

        if q.text() == "Tiled":
            self.mdi.tileSubWindows()        

if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    ex = MainWindow()
    ex.setWindowTitle("Menu")
    ex.show()
    sys.exit(app.exec_())
import sys

from PyQt5.QtWidgets import QMainWindow, QMdiArea, QAction, QApplication

from register import window                                 # +++

class MainWindow(QMainWindow):
    count = 0

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.mdi = QMdiArea()
        self.setCentralWidget(self.mdi)
        bar = self.menuBar()

        file = bar.addMenu("File")

        open_action = QAction('Open', self)                  # +++
        file.addAction(open_action)                          # +++

        file.triggered[QAction].connect(self.openRegister)
        self.setWindowTitle("Menu")

    def openRegister(self):
#        from register import window
        self.win = window(self.mdi)                           # +++

def main():
    app = QApplication(sys.argv)
    ex = MainWindow()
    ex.show()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()
from PyQt5.QtWidgets import  QPushButton, QGridLayout, QDialog,QGroupBox, QVBoxLayout, QApplication


class window(QDialog):
#    def __init__(self):
#        super().__init__()
    def __init__(self, parent=None):
        super(window, self).__init__(parent)

        self.title = 'register'

        self.initWin()

    def initWin(self):
        self.setWindowTitle(self.title)


        self.gridLayoutCreation()
        vBoxLayout = QVBoxLayout()
        vBoxLayout.addWidget(self.groupBox)
        self.setLayout(vBoxLayout)
        self.show()

    def gridLayoutCreation(self):
        self.groupBox = QGroupBox('')
        gridLayout = QGridLayout()

        qutBtn = QPushButton('Exit')

        gridLayout.addWidget(qutBtn, 0, 0)
        qutBtn.clicked.connect(self.qut)


        self.groupBox.setLayout(gridLayout)

    def qut(self):
        self.close()


# win = window()
if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    ex = window()
    ex.setWindowTitle("Menu")
    ex.show()
    sys.exit(app.exec_())
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton
from PyQt5.QtGui import QPixmap, QIcon


app = QApplication(sys.argv)
mainRoot = QWidget()
mainRoot.setWindowTitle('Login')
mainRoot.setWindowIcon(QIcon('im.png'))
lblBackground = QLabel(mainRoot)
pic = QPixmap('Ok.png')
lblBackground.setPixmap(pic)
mainRoot.setGeometry(600, 300, 322, 220)

user = QLabel('user name', mainRoot)
user.move(50, 50)
password = QLabel('password', mainRoot)
password.move(50, 80)

username_edt = QLineEdit(mainRoot)
username_edt.move(110, 50)
password_edt = QLineEdit(mainRoot)
password_edt.setEchoMode(QLineEdit.Password)
password_edt.move(110, 75)
signin = QPushButton('sign in', mainRoot)
signin.move(20, 110)
registerBtn = QPushButton('register ', mainRoot)
registerBtn.move(120, 110)
qut_btn = QPushButton('Quit', mainRoot)
qut_btn.move(220, 110)

def registerUser():
#    import register
    from register import registerForm    
    form = registerForm()
    form.show()


registerBtn.clicked.connect(registerUser)
qut_btn.clicked.connect(quit)

mainRoot.show()
sys.exit(app.exec_())
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton, QComboBox, QRadioButton
from PyQt5.QtGui import QPixmap

app = QApplication(sys.argv)

def registerForm():                                       # <=======
    signRoot = QWidget()
    signRoot.setWindowTitle('Registration')
    lblBackground = QLabel(signRoot)
    pix = QPixmap('image\pic-10.jpg')
    lblBackground.setPixmap(pix)
    signRoot.setGeometry(600, 300, 400, 300)

    fullNameLbl = QLabel('Full Name', signRoot)
    fullNameLbl.move(100, 50)
    userNameLbl = QLabel('User Name', signRoot)
    userNameLbl.move(100, 80)
    passWord = QLabel('password', signRoot)
    passWord.move(100, 110)
    typeLbl = QLabel('Type', signRoot)
    typeLbl.move(100, 140)
    departmentLbl = QLabel('Department', signRoot)
    departmentLbl.move(100, 180)

    fullName = QLineEdit(signRoot)
    fullName.move(200, 50)
    userName = QLineEdit(signRoot)
    userName.move(200, 80)
    passWord = QLineEdit(signRoot)
    passWord.setEchoMode(QLineEdit.Password)
    passWord.move(200, 110)

    maleType = QRadioButton('Male', signRoot)
    maleType.move(200, 140)
    femaleType = QRadioButton('Female', signRoot)
    femaleType.move(270, 140)
    department = QComboBox(signRoot)
    department.move(200, 180)
    submitted = QPushButton('Submit', signRoot)
    submitted.move(150, 240)
    qut_btn = QPushButton('Quit', signRoot)
    qut_btn.move(250, 240)

    def qutRegisterForm():
            signRoot.close()

    qut_btn.clicked.connect(qutRegisterForm)
#    signRoot.show()

    return signRoot                                           # <=======
Related Posts Related Posts :
  • Looking for a .Net ORM
  • Cost of SortedDictionary.Count
  • All possible combinations of n items selected randomly from a set of x items (algorithm)
  • Displaying process percentage on DOS screen
  • C# Importing Large Volume of Data from CSV to Database
  • c# control location precision
  • Printing to Zebra printer gives faint and blurry images
  • How to avoid stepping into dll code file?
  • Programmaticaly prevent Vista desktop search (WDS) from indexing pst files placed on mapped network drives
  • Is there anyway to reduce IsolatedStorage capacity in Silverlight?
  • C#: How to print a unicode string to console?
  • Frequency Table with Random Values
  • My Visual Studio 2008 web application keeps throwing a .Net error when I first run it, but refreshing fixes it
  • TCP Connection Creation and Closing Event Hooking
  • Find changed properties of a class
  • C#: Object with custom marshaller not containing data after PInvoke call
  • Version Control System with API. Need to get metrics
  • Performance comparison of Dictionaries
  • How to get process name and title of the top window on Windows / C#
  • How to save the ListView contents to a text file?
  • Why not .NET-style delegates rather than closures in Java?
  • Get CLSID by PIA interface Type
  • Visual Studio 2008 C# - Recover solution from application manifest possible?
  • Is a good practice to initialize private data members from within ctor by calling the associated properties instead of t
  • Inserting into a bitstream
  • How do you write byte[] array using log4.net
  • Clickonce + .NET client profile 4 framework + offline
  • Show form that showDialog from mainForm won't block it, but closing mainForm will close it
  • Developing a GPS car tracking system
  • dynamic log4net appender name?
  • Visual studio formatting issue
  • IndexOutOfRangeException when a stream is a multiple of the buffer size
  • How to deal with calculated values with Dependency Properties on a custom WPF control
  • counting from textbox,asp.net
  • Threading best practice when using SFTP in C#
  • how to load PDF file in website page using C#
  • Parent child class relationship design pattern
  • MessageQueue.BeginReceive() null ref error - c#
  • A C# collection, which behaves like C++ set or priority_queue?
  • Animating WPF buttons from inside a style
  • WPF Grid : GridSplitter event
  • Server 2008 Task Scheduler Mapped Drive Access C#
  • Cast problem with LINQ
  • Combo box Item source = ObservableCollection & I need a '-None-' dummy entry at the top
  • Which GUI control is suitable for this purpose?
  • Trying to access App.config file for mail settings but fails to work
  • Invoke PowerShell script from c# in runspace and get line number where error occured
  • How to show html contents with a RichTextBox?
  • FTP monitoring and downloading of new files
  • MEF + Plug-In not updating
  • Efficient handling of super wide, but not so tall, bitmap?
  • .NET 3.0 Unit Testing getting System.MethodAccessException calling .NET 2.0
  • Web Services vs Persistent Sockets
  • How do I dynamically reference incremented properties in C#?
  • Windows Installer (C#) error code 2869
  • Exception "The operation is not valid for the state of the transaction" using TransactionScope
  • Tools for listing database accesses from .NET code
  • Excel VSTO set selection
  • Creating a subscription based website in ASP.NET
  • Merging Resources Dictionaries
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk