C# :: Pass Data From One Window To Another Or To User Control?

Aug 26, 2014

I am wondering what the best way would be for me to pass a piece of data between all of my different windows and user controls in my program.

Would i have to pass it separately between them e.g. add a piece of code into the button click event that will open the new window.

Or is there a way i can make it so that it is declared in the first window and then is accessible by all other windows and user controls.

Note: this is using WPF.

View 14 Replies


ADVERTISEMENT

C# :: How To Pass Data Into User Control

Apr 1, 2014

(C#, visual studio 2010, Windows Forms Application)

Ive set up one form that has two labels at the top (Western, Eastern). Below that I have a tabcontrol that contains two tabs (Sales, Products)

I have added four user controls:

WesternSales
WesternProducts
EasternSales
EasternProducts

The idea is that when you click on one of the labels (Western or Eastern) you access the tabs relevant to that region.

So, If i click on the "Western" label and then the "Sales" tab, the program loads the WesternSales usercontrol into the Sales tab. Likewise, if I click on the Eastern label and then the Sales Tab, the program loads the EasternSales usercontrol into the Sales tab, etc.

I want to eliminate the need for multiple data adapters. How can I load data from our database into each of the respective usercontrols using one data adapter?

View 2 Replies View Related

C# :: User Control Being Blank On Main Window

Jan 5, 2015

I have followed the tutorial here - [URL] .....

This is a tutorial that I have gone through completely with success, but now I am trying to create a different project using the same sort of setup.

When I add my usercontrol to the MainWindow it has none of the buttons/TextBlocks on which I have put on the UserControls - It is just a blank box. What could be causing this?

I have changed the name of the project to [snip] because it has a company name in it...

"NumericControl.xaml"
<UserControl x:Class="[snip].UserControl.View.NumericControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

[Code] ....

View 14 Replies View Related

C# :: Change Form Control Properties From User Control

May 24, 2014

I have researched quite extensively, experimented, and still cannot seem to change the properties of a control on an active winform from a user control.

So I have a user control which populates each dynamically added tab page in a tab control.

I have a textbox in the user control which I would like to type in, capture the text_change event, and change the text of the label in the winform.

View 14 Replies View Related

Visual C++ :: Child Window On Top Of Control

Nov 30, 2014

I have a child window above an edit control.

When the position of the control in the parent in the child on top of it is clicked the control gets topmost. Is there any way to prevent this?

View 3 Replies View Related

Visual C++ :: Control On Parent Window

Feb 18, 2014

I need Edit Box and List Box controls on the Parent Window or Main Window of my application. I know how to use them in dialogs ..

I will need to Read/Write/Modify data from Edit Box . How to do this ?

View 4 Replies View Related

C# :: Pass Button Click To Parent Control?

Apr 19, 2014

I want Buttons to pass-on Click to their parent control. I'm creating a user-control to do this, and I am using TableLayoutPanel to test.

I found some code (below) but neither do anything for me. SO topic related article

namespace ArrayButtons {
public partial class MyButton : UserControl {
public MyButton() {

[Code].....

View 3 Replies View Related

C# :: How To Create A Window Where User Can Open A File

Dec 15, 2014

I am using

string text = System.IO.File.ReadAllText(@"C:datainput.txt");

to open a file and save it content to "text"

How can I instead create new window where user will select the .txt file he wants to read like many applications do

This is a WPF application

View 10 Replies View Related

C# :: Can't Set Image For User Control In Winform

Nov 12, 2014

So I am upgrading the system from 3.5 .NET to 4.5.1 and fixing any bug that I could find. Long story short, I run into an issue that basically tell me it couldn't find the images in the resource file. I figured out a work around, but first I have to set the picture box or background Image in design time to none. I ran into this Properties Windows while changing the value of picturebox for my user control saying: Property value is not valid. Object reference not set to an instance of an object. This usercontrol is taken from another user control from a different project. Basically, we are reusing it.

View 9 Replies View Related

Visual C++ :: How To Retrieve Window Proc In Process Running In Other User

Apr 25, 2014

I am encountering a problem on retrieving the Window Proc of a window that running in a process with another user.

For example, I have logon windows with domainuser1, and run the following command as:

runas /profile /env /user:domainuser2 C:WindowsSystem32calc.exe

And then the Calculator is shown in domainuser1 desktop, but the process is running in domainuser2 account.

When running Spy++ (either wither domainuser1 or domainuser2) to view the calculator window, the Windoe Proc field is shown 'Unavailable' I also try to call GetWindowLong against this window, it will always returns NULL.

I am just wondering if it is possible to retrieve the Window Proc of the window running in a process of another account, is is possible?

View 9 Replies View Related

C Sharp :: How To Consume Data From The Web Service In Window Application

Feb 13, 2015

I am developing project on window application in c#.net. I want to consume the data from the web service and that web service is developed in PHP. So, How to give the reference of that web service?

View 1 Replies View Related

Visual C++ :: List Control Column Data

Jan 31, 2013

I am trying to populate a list control with the filename and maybe some other thing when i push the OK button....

Code:
void CThisDlg::OnOK() {
int iItem = 0, iActualItem = 0;
HANDLE hFind;
WIN32_FIND_DATA data2;
int iNum = 0;
hFind = FindFirstFile("*.*", &data2);

[Code] ....

When i push ok, no files get loaded. I also attached a image

View 13 Replies View Related

C# :: How To Pass Bitmap Data Type To DLL

Jun 24, 2014

C# Code

[DllImport("dllTestForm.dll", EntryPoint = "showFormC")]
static extern void testShowFormC(byte[] photo,int len);
private void button6_Click(object sender, EventArgs e) {
Bitmap bmp = (Bitmap)Image.FromFile(@"d:11.jpg");
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);

[Code] ....

The program has no tip errors ,But there is no any picture display in c++ form,Tested the simple data types, such as int, can be normal .

View 1 Replies View Related

C++ :: Traffic Control Program - Output Data At Specific Time

Oct 24, 2013

I was given an assignment to create a simple program for traffic control. How should i output data at a specific time, for e.g a driver approaches an intersection, the yellow light will flash indicating that he needs to slow down and then the red light to stop before taking a route. is there any function i can use to output red light a few seconds after yellow light.

View 10 Replies View Related

C# :: Bind DatePicker Control To DataGrid Control (column)?

Apr 25, 2014

How do I bind a DATE column in a DataGridView Control to a DatePicker control (using C#)? I already have the DataGridView control bound to a database stored procedure which takes a DATE value as a parameter and selects joining table based on the results.

View 7 Replies View Related

C# :: How To Access User Control Form One Of The Child Form

Apr 22, 2014

I hav created mdi parent form that contain one user control. I want to access that user control from one of the child form

View 4 Replies View Related

C++ :: What Is The Difference Between Pass By Reference And Pass By Pointers

Jan 23, 2013

I've been given an assignment with the below questions.

1. What is the difference between pass by reference & pass by pointers?

2. What is the use of the initialization list in the constructor?

3. What is meant by a reference & its advantage?

4. Class has a reference, pointer and a const. Is it possible to write the copy constructor & assignment operator overloading funciton? how? ( Since reference is there, I'm not sure on how to write for it)

5. Example for a variable decleration and definition? (I know for function but for variable don kw how)

6. static and const static what is the difference??

View 1 Replies View Related

C# :: One Thread Trying To Pass Data To Another Thread Using Serial Port

Jul 30, 2014

I have a class which I wrote and one of its object is "SerialPort" .NET class. In my MainWindow I created instance of my class called "SerialPortComm", then I send through some functions of mine, commands to the Serial Port, and I receive answers through "DataReceived" event.

But when I trying to use Dispatcher.BeginInvoke to write my data I have received (successfully), nothing shows on the RichTextBox which I'm trying to write to.

What can caused that, and How I can make it works?

SerialPortComm.cs

public partial class SerialPortComm : UserControl {
public SerialPort mySerialPort = new SerialPort();
public void Open_Port(string comNumber, int baudRate) {
mySerialPort.PortName = comNumber;
mySerialPort.BaudRate = baudRate;

[Code] ....

View 7 Replies View Related

C++ :: Difference Between Pass By Value And Pass By Reference?

Jul 2, 2014

// explain difference between pass by value and pass by reference

void addOne(int i)
{
i++;
}
void addOne(int& i)
{
i++;
}

View 2 Replies View Related

C/C++ :: Let User Select Data Type From Menu

Nov 17, 2014

I have created a generic array-like template to create arrays of different types. Now I need to get user input from a menu about which type of array they are building. I tried having the user enter a number and using that number to pick a string from an array of constant strings. But pretty obviously, that threw a type conversion error. Is there a way to convert the literal string of a type into it's type or refer to a type directly.

Here is the code I need to fit a type into at runtime:

SimpleVector<TYPE> myVect = SimpleVector<TYPE>(dataSize);

View 5 Replies View Related

C++ :: Set Width Of Data Values Which User Will Input

Sep 24, 2014

I am trying to set the width of the data values which the user will input when using the program but I don't know how to get it to show the values when I tryto set the width of the variables in a nice column .

//Programming Assignment 4

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main() {
double q1r1, q2r1, q3r1, q4r1;
double q1r2, q2r2, q3r2, q4r2;
double q1r3, q2r3, q3r3, q4r3;

[Code] ....

View 2 Replies View Related

C++ :: How To Stop Outputting Data Based On A User Input

Sep 27, 2013

how to stop outputting data based on a user input. The text file is as follows:

1. a
2. b
3. c

and the code I'm using is as follows:

int main (){
string line;
int search;
cout << "Enter a number from 1-3" << endl;
cin >> search;
search++;
ifstream myfile ("example.txt");

[Code]...

What I want to do is to just output number 1 (the whole line) if the user enters number 1. However, I get an error on the second condition w/c is the "&& line!= search"

View 1 Replies View Related

C++ :: Looping User Input For Specific Data Type

Apr 17, 2015

Here's my code so far:

Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int dayNumber = 1;

[Code] ....

The code, when run, prompts the user to input an integer like this:

Code:

Day 1
Andy :>12
Bill :>7
Charlie :>15

Day 2
Andy :>5
Bill :>25
Charlie :>14
.
.
.
etc.

Ok, so the code prompts the user to enter an integer for each of the 3 persons and then increments the "Day" and so on... When the user enters a negative value (-1, -2, etc.), the loop is broken and the program ends. Alright, everything is hunky-dory so far. 2 things which I can't figure out.

1. when the user doesn't enter anything and just hits return, the cursor drops a line and is still awaiting an input but doesn't show the prompt "Andy :>", for example. How can I get it to repeat the last prompt when the user doesn't enter anything? Like:

Code:

Day 1
Andy :>
Andy :>
Andy :>12
Bill :>25
Charlie :>15
.
.
etc.

2. When the user enters a letter or a special character, the program blows up. How can I correct this?

I've tried changing the data type for the variable used for the input, tried using getline, get, etc. With my current beginner knowledge, I'm missing something. So how can I get this to work?

The program should allow only integers to be entered, while allowing a negative number to trigger the loop to break or the program to end, and while re-prompting the last person if the user entered an invalid input.

View 13 Replies View Related

C++ :: Pass By Value And Pass By Reference?

Apr 17, 2013

i think i understand both concept. i know that pass by value is that the function receiving those values makes actually a copy of those parameters. Passing by reference makes the variable in the main function to actually see those changes in the other function, instead of a copy, and apply them to the variable in the main function. my question is, why would i pass it by reference if i just can make a return type function.

View 5 Replies View Related

C/C++ :: Pass By Reference And Pass By Value?

Nov 27, 2014

I need to put my Dice() function as pass by reference and something as a pass by value, it can be in the same function.

#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;

[Code].....

View 6 Replies View Related

C++ :: Input Data Of Object From User And Then Insert It In Linked List

May 16, 2013

Error:
--------------------Configuration: nc - Win32 Debug--------------------
Compiling...
cv.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/nc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

nc.exe - 2 error(s), 0 warning(s)

Compiles with 0 error but on running 2 Errors appear.

I'm Inputting data of an object from user and then inserting it in the link list.

#include <iostream>
//#include <fstream>
using namespace std;
#define LEN 100
////////////////////////////////////////////////////////////////////////////////////////////////////
class employee{

[Code] ....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved