I will be showing how to pass data between two forms in C#. I will be using two forms, two classes which we will define, a delegate, an event, and an event handler. It is a bit long because I wanted to make it easy to follow. If you want to skip the explanation and just see the code, scroll down to "The short version:" * A form named: MainFrm * A form named: ChildFrm * A class named: ScheduleInfo * A class named: ValueUpdatedEventsArgs An instance of ChildFrm will be created and shown when clicking a button on the …

Member Avatar
Member Avatar
+4 forum 1

hi. can any one help. i am doing a java application. and using a button listener class. and says cannot find the text box object. can you help. will do the sample code. how to get this to work. marvin. ps: here's the code if(e.ActionCommand().equals("btnName"}} {JOptionPane.showMessageDialog("My name is: " + txtName {+ " "); System.exit(0); } how to fix this. what is the correct code. and then get this error. marvin.

Member Avatar
Member Avatar
+0 forum 1

Hello good day. I am having trouble letting my listeners wait on each other. I have a 1. JComboBox 2. JList - groups 3. JList - students The choice from the JComboBox, clears and updates the groups JList by way of an actionlistener. The ListSelectionListener for the groups JList, then responds to you selecting data (that was just added). The choice is refelcted in the students JList. The trouble is I am getting a NullPointerException at random times. I believe this happens because in order to update the groups-JList via the ComboBox's ActionListener, I need to clear it's contents first. …

Member Avatar
Member Avatar
+0 forum 6

Hello good day. I am designing two JTables; one on top of the other. The first one has nine columns. And the second one has 8 columns (The first column spans the first columns of the topmost table). What I wish to do now is to make the bottom table reactive to the movement of the margins in the topmost table. I wish for them to stay aligned. How do I accomplish this please?

Member Avatar
Member Avatar
+0 forum 19

Hello Good day. Here is the problem I am trying to solve. I have a table as seen below. ![232465554203149acd8363d3a4a127ae](/attachments/large/3/232465554203149acd8363d3a4a127ae.jpg "232465554203149acd8363d3a4a127ae") My GOAL: Columns A through G are going to be filled with integers. (I have already created an integer model so that these cells only take integers). As the cells in that range are filled, the Totals column will decrease in number until it reaches zero. So far I have managed to use a TableModelListener to respond to the changing cell values. What I wish to do now is to prevent a cell, *that is being edited*, from *accepting* …

Member Avatar
Member Avatar
+0 forum 14

We have a sensor on our local network that is sending a data telegram using UDP Broadcast. How do we use Winsock to capture these messages. The Port number that the data is being sent on is 42567. I tried the following code WinSockControl.Protocol = sckUDPProtocol WinSockControl.RemotePort = 42567 WinSockControl.Bind When stepping through this code in the IDE it accepts all these commands however it ver triggers the WinSockControl.DataArrival. Can anyone tell me what I am doing wrong. I assumed that as the data is being broadcast around my subnet all I need to do is listen. Thank You

Member Avatar
Member Avatar
+0 forum 7

Hello, I want to implement Change Listener in the Action Listener of a Button I have a color graph chooser and 2 buttons...Apply and Cancel to select the color of the color chooser i have implemented the Change Listener but I want the change listener to act on the Apply button click... Since the listener which I have written is not in the apply button it takes place even when I click on cancel button.... code for change listener final JColorChooser ColorChooser = new JColorChooser(Color.black); ColorChooser.getSelectionModel().addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { newColor = ColorChooser.getColor(); } } ); code …

Member Avatar
Member Avatar
+0 forum 2

Hello Everyone I have an Internal frame in my application which has a JTable populated with values from a database and a JButton which performs some operation when a row is selected from the JTable.When the user does not select a row from the JTable and clicks the JButton, I would like to show a message asking the user to select a row from the table first.I have tried a few things but none seemed to work.Could someone point me in the right direction please.Any help would be greatly appreciated. [CODE] /* * To change this template, choose Tools | …

Member Avatar
Member Avatar
+0 forum 7

Hello, I am confused between the differences between a key logger and key listener in Java....i looked online but I couldn't find a straight-up answer. Thanks in advance!

Member Avatar
Member Avatar
+0 forum 4

I used one action listener for an array of buttons that do different things. Exploring methods. I am fairly new to java. I just made a tic tac toe program. I am hoping for people to look it over and tell me what they think, ways to make it better, new areas to explore. ect. I know the Check method is more complicated then it has to be, but I freakin love it. [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class tictactoe extends JFrame{ public static JMenuBar MenuBar = new JMenuBar(); JMenu File = new JMenu("File"); JMenu Help = new …

Member Avatar
Member Avatar
+0 forum 11

I need to know how I can set up a action listener for an array of buttons. I am trying to make a tic tac toe game. I am new to programming. I have seen someone on here ask a similar question but I could not grasp what they where doing because my program is set up different. [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class tictactoe extends JFrame{ public static JMenuBar MenuBar = new JMenuBar(); JMenu File = new JMenu("File"); JMenu Help = new JMenu("Help"); JMenu Options = new JMenu("Options"); JMenuItem NewGame = new JMenuItem("New Game"); JMenuItem Exit = …

Member Avatar
Member Avatar
+0 forum 11

Hi All, Is it possible to bind an array or a Vector with a event listener? For an example if we add an element to the Vector or remove from the Vector, can I use an event listener to track the changes? Thanks a lot in advance. Cheers..!!

Member Avatar
Member Avatar
+0 forum 5

Hi Friends, I need to get the data from the port that sent by an external device connected to my server's IP. I found the data sent by the device in my server using the TCP Port listner . Now i need to get the data to store in mysql. This is code that i used. <?php $host = "122.165.218.14"; $port = 4321; set_time_limit(0); echo "Start to Create() socket...."; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("create():".socket_strerror(socket_last_error($socket))); echo "Start to Bind() Socket...."; $result = socket_bind($socket, $host, $port) or die("Bind():".socket_strerror(socket_last_error($socket))); while (TRUE) { $input = socket_read($socket,1024); $input = trim($input); echo $input; ob_flush(); …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone, I am trying to get an ActionListener to work in Java. On lines 310 and 312 it says 'cannot find symbol: variable calcDisplayF'. I am a complete noob when it comes to Event Handling so any help on this subject would be greatly appreciated. Here is the code (warning, it's long (315)): [code=java] /* * Creating here for development * * Please save all questions until the end of class... */ package macey; /** * @author Mike */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class normCalcDev implements ActionListener { public void normCalc() { // Content Pane JPanel …

Member Avatar
Member Avatar
+0 forum 5

Is there a way to add a mouse listener to an image for example when the image is clicked change the text of a label... :?: Any help would be greatly appreciated Thanks’ :)

Member Avatar
Member Avatar
+0 forum 4

This has taken many hours of mine. I have to get this .Net app to run on an XP system. Someone seems to have messed up some files so conn.Open() in the C# is causing this error: [CODE]Connection Error:Oracle.DataAccess.Client.OracleException ORA-12170: TNS:Connect timeout occurred at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleConnection.Open() at Service.connect(Int32 sql_choice, String databaseIdentifier, String authenticationKey) in c:\Documents ....[/CODE] This is my sqlnet.ora file: [CODE]# sqlnet.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora SQLNET.AUTHENTICATION_SERVICES= (NTS) NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) SQLNET.INBOUND_CONNECT_TIMEOUT = 180 SQLNET.SEND_TIMEOUT = 180 SQLNET.RECV_TIMEOUT …

Member Avatar
Member Avatar
+0 forum 1

Hello guys, I have a TCP Listener Server which listens to requests and replies them. It is working fine in a particular network. But what if i would need to make it available for everyone (my clients) over internet to connect to it and send receive messages/data? My current code is working fine in LAN setup but what things I need to make to let my clients/users connect to it over internet? please help me. Following is the code: [CODE] using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; public class ThreadedTcpSrvr { private TcpListener client; public ThreadedTcpSrvr() { …

Member Avatar
Member Avatar
+0 forum 1

Hi, using old pure C, I was able to define a custom windows message. Once done, it was possible to broadcast the message across my application. Any object, with defined listener was able to receive and process the message. OK, right now, I need to do the same in C#. I have a class (let’s call it ABC), which should broadcast a message in case something happens. The application has multiple forms (some of the are active, some of them not - that’s why I need general broadcast message/event instead of call a specific method). In case, something happens (e.g. …

Member Avatar
Member Avatar
+0 forum 6

The End.