C# :: Unable To Send Event Successfully

Jan 12, 2015

In my MainWindow I have a UserControl called CamAccessLevel1. This will be one of a few different UserControls which will have more and more functionality to a device as the Level goes up.

Each of those functionalities are themselves a UserControl, so that I don't have to keep remaking them for each different "Level" that I make.

So... I have a UserControl in a UserControl in my Mainwindow. My first goal is to have a button in one of those sections send an event back to the MainWindow to close the application. This sections is called "ProgramControl", as it has functions that relate to the program itself.

I can't seem to set a datacontext within another datacontext -> There is an error in UIViewModel below...

Note that I have replaced my company name with [snip]

In my Mainwindow.xaml
<views:CamAccessLevel1 x:Name="UserInterface"/>
Mainwindow.xaml.cs
public partial class MainWindow : Window {
#region MyModel

[code]....

View 10 Replies


ADVERTISEMENT

C Sharp :: Unable To Successfully Submit List Of Authors From Listbox

Jan 17, 2014

I need to add either one author or a list or array of authors to my sql table. Here is the code that is used to insert the authors into the table:

The code from the listbox:

<asp:ListBox runat="server" ID="AuthorList" DataTextField="AuthorName" 
            DataValueField="AuthorName" DataSourceID="Authors"  SelectionMode="Multiple"/>    

Datasource code:

<asp:ObjectDataSource runat="server" ID="ds_InventoriedAuthors" 
SelectMethod="GetAuthors" TypeName="CntyLibrary.Inventory.Authors" InsertMethod="AddAuthors">
    <InsertParameters>
        <asp:QueryStringParameter Name="AuthorID" Type="Int32" QueryStringField="id" />

[Code] ....

View 3 Replies View Related

C :: Unable To Send Binary Data Via HTTP Response

Feb 7, 2013

I'm trying to send some binary data, such as an animated gif, via an HTTP response for a simple web server.

I am having issues having the browser close the connection after receipt of the data.

I create the header such as:

"HTTP/1.1 200 OK
Content-Length: <file size>
Content-Type: <file type>
<binary data>"

This is stored in a malloc'ed char *. To add the binary data I'm using fread: fread(request + strlen(request), 1, size, fp)

I then write 'total' bits via connfd:

write(connfd, request, total)
where total = strlen(headerRequest) + size + 3 (for ending
).

The writing seems to be okay however the image doesn't load and the browser still seems to be waiting for data.

If I added "Connection: close" to the header and closed connfd myself the page loads fine. Obviously, for efficiency purposes, I'd rather only close connfd once read() returns 0.

The header creation code is below:

======= Code:

/* Try to get file */
strcat(cwd, file);
if(endsWith (cwd, ".html") || endsWith(cwd, ".htm")) {
strcpy(fileType, "text/html");
binary = 0;
} else if (endsWith(cwd, ".txt")) {
strcpy(fileType, "text/plain");
binary = 0;

[Code]...

View 7 Replies View Related

C/C++ :: Unable To Send Maximum Long Value Through Function Call

Jun 11, 2014

I am trying to send the maximum long value through function call, but i didn't print proper value..

[
#include <stdio.h>
long long floatToInteger_old(float value){
printf("float val : %e",value);
}
int main(){
float value = 340168346567;
long long finalhexVal = floatToInteger_old(value);
return 0;}
]

my actual output is 340168346567, but it is printing 3.401683e+011 or 340168343552.000000.
how can print exact value what i am sending.

View 7 Replies View Related

C++ :: Code Compiles Successfully Yet Previous Day Is Blank

Feb 17, 2013

//#include "stdafx.h"
#include<iostream>
#include<cmath>

using namespace std;
//class declaration
class dayType{
public: int presday;

[Code] ....

So everything works perfectly, well not everything lol. Code compiles successfully without any errors but previous day does not calculate. In a sense that when it asks for number of previous days it returns a blank statement.

For example: Previous number day is: shows nothing

View 2 Replies View Related

C++ :: Guessing Game - How To Successfully Loop Back To The Beginning

Feb 5, 2015

So I'm making my first program w/ C++ and its a game guessing game. I've learned how to use booleans, chars, strings, if/else, loops, and input. Anything past that I dont know. I've gotten my game to work properly except for the fact that when you guess incorrectly, the program closes. I want the program to go to the beginning of the program again so the user can restart. So far i've gotten the loop to beginning thing to work but not well. It'll only repeat twice before closing again and it'll say the user got the wrong answer even if it was correct. Here's my code

#include <iostream>
#include <string>
#include <random>
#include<ctime>
using namespace std;

int game(){
string playerName;
int guess;

[Code] ....

View 1 Replies View Related

C++ :: Program Compiles Successfully But Calculations Give Wrong Answer

Feb 11, 2013

I'm using MSVC++ and it builds sucessfully but somewhere something is obviously messed it. Once i try to debug it just shows weird numbers.

int k=0; //could this be the problem??? since 0 would be over writing any given value. but if i leave int k; it showsa warning and MSVC would count that as an error

#include "stdafx.h" //Header file section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//structure declaration
struct menuitemtype

[Code] ......

View 14 Replies View Related

C# :: Event Into Array?

Feb 18, 2015

i need to change the text in multiple ComboBoxs. i could do it one by one, but i have about 11 i need to change. i feel like doing it one at a time is not efficient. i was wondering if i can put the comboboxs into an array so i can use a for loop to change them all with out writeing it out 11 times.

View 9 Replies View Related

C# :: How To Reuse Event

Apr 14, 2014

I am creating one c# project. In this project I have one mdi form and many child forms.

All the child forms contains one panel named as panel1.

Now when child form opens i use the following code in all child form all child forms' load event contains the following line.

this.WindowState = FormWindowState.Maximized;

and all child forms' resize event contains the following line.

panel1.Left = (this.ClientSize.Width - panel1.Width) / 2;
panel1.Top = (this.ClientSize.Height - panel1.Height) / 2;

so my question is if possible that the above code i write only once so i donot write this code in all the child forms load and resize event.

View 2 Replies View Related

C++ :: Connecting Event With A Key On Keyboard?

May 17, 2013

I am gonna make a simple game in c++. I need a way how to use a particular key on the keyboard ,when I hit the key certain function should be called.

For movement of cursor on screen I want to connect arrow keys.

View 4 Replies View Related

C# :: Filtering Strings That Get Sent On A Event

Feb 4, 2015

I am writing a application that receives Event messages from a network device the problem I have is that the device sends some message 5 times per tiggered event on two of the events I like to use the rest of the messages are fine I need to create code to filter out the other 4 last messages that get displayed in a textbox the 5 message are identical I have added a timestamp to the sting and noted they are always 1 second apart so the format would be somthing like this:

11:23:01 - x - y
11:23:02 - x - y
11:23:03 - x - y
11:23:04 - x - y
11:23:05 - x - y

What I would like to do something like this, always append the first message to the textbox but ignore or even change the 4 messages that follow 1 second apart from each other that contain - x - y if any other message appears it should still append the text box as well

so the result i would like for the 5 event message as above should end like this:

11:23:01 - x - y
11:23:02 - custome message / ingnore append to textbox
11:23:03 - custome message / ingnore append to textbox
11:23:04 - custome message / ingnore append to textbox
11:23:05 - custome message / ingnore append to textbox

View 8 Replies View Related

C# :: Calling Event From Another Form

Mar 11, 2015

I want to update a label from Form2. When I click on the button on Form 2, the textbox on Form2 should update the label on Form1 and take me to a certain website. What ever URL is typed into the textbox on Form2 is what website URL the label on Form1 will take me to. The label on Form1 can say something such as You can check out my website here!!! and when they click on the saying it takes me to their website.

View 2 Replies View Related

C# :: Passing Event As A Parameter

Nov 16, 2014

I want to create events and then, functions which are subscribed to the event can access information about the event. For example, in Class 2 below, I want it to be able to access things such as touch.position, etc. of class 1.

Class 1:

public delegate void TouchEventHandler (EventArgs e);
public event TouchEventHandler TouchBegan;
public Vector2 touchPosition;
void Update () {
if (Input.touchCount > 0) {

[Code] ...

Class 2:

void OnTouchBegan (EventArgs e) {
Debug.Log ("Ran");
}

View 5 Replies View Related

C# :: WPF Background Changed Event?

Dec 5, 2014

I'm still at the very beginning of learning WPF and there are still countless things i don't fully understand. For instance, as I can see in my WPF project, there isn't an event that would fire when the Background property of some control is changed. Or am I just missing it? If i'm not blind after all, and it really doesn't exist, is there any way i could get notified when the Background color of some control is changed?

View 5 Replies View Related

C# :: Find Event For Combobox When Its Selected Value Changes

Jan 28, 2015

I'm trying to find an event for the combobox when its selected value changes , but I can't seem to find the right one since I've tried several events in the dataGridView that are just triggering at the wrong moments. I need to remove the selected item from that combobox so that it doesn't get selected again at the second combobox which usually have the same items .

View 5 Replies View Related

C++ :: Two Way Event-driven Communication Between Objects

Oct 26, 2013

I need to implement a two-way asynchronous communication between two objects, not using any IPC.

What I have now is a producer-consumer model where producer sends a number "88" to consumer at random intervals. Now, I need consumer to send a number "99" back to producer at a random intervals, this probably should be done in a separate thread.

I am using GNU on Linux, here is the compile line.

Code:

g++ -g -std=c++11 main.cpp -o main

Code:

#include<iostream>
#include<chrono>
#include<thread>
class IObject {
public:
virtual void fromApp(int i) = 0;
virtual int toApp(int& i) = 0;// ???

[code].....

View 8 Replies View Related

Visual C++ :: DLL And Write To Event Viewer

Dec 11, 2013

i want to write to event viewer

Code:
void EventLogCls::WriteError( char* msg) {
HANDLE hes = RegisterEventSource(0, appName);
if(hes) {
WORD dwEventType = EVENTLOG_ERROR_TYPE;
ReportEvent(hes, dwEventType, 0, 0, 0, 1, 0,(const char**)&msg , 0);
DeregisterEventSource(hes);
}
}

The error that i get is on the line of "ReportEvent"

error C2664: 'ReportEventW' : cannot convert parameter 8 from 'const char **' to 'LPCWSTR *'

what should be changed?

View 3 Replies View Related

C# :: Treeview Control In WPF Double Click Event

Jan 8, 2015

<TreeView Grid.Column="0" Margin="0,-15,0,15" Grid.ColumnSpan="1">
<TreeViewItem Header="Custom"/>
<TreeViewItem Header="All Conferences"/>
<TreeViewItem Header="Atlantic Coast Conference" MouseDoubleClick="TreeViewItem_MouseDoubleClick_1">
<TreeViewItem Header="Atlantic" MouseDoubleClick="TreeViewItem_MouseDoubleClick"/>
<TreeViewItem Header="Coastal"/>

[Code] ....

I am trying to do a LINQ Query by Double Clicking the child node. When I click on the parent node it brings up the correct data. But when I click on the child node it still brings up the data from the parent node. How do I get the child node to display the correct data?

View 2 Replies View Related

C# :: WPF Databound ListView Item Click Event?

Aug 27, 2014

I was using the same item click event on another listview, and it worked perfectly... I don't know why this is happening, but here's my problem:

When I double click on an item, and try to obtain its index in the listview, the items index always comes back as -1... Obviously -1 isn't an index, and I'm guessing that it is returning -1 because that item does not exist on the listview, but from what I'm seeing, it is impossible for the item not to be inside of the listview...

Here is the xaml for my listview:

<ListView x:Name="lstBookmarks" HorizontalAlignment="Left" Height="250" Margin="10,10,0,0" VerticalAlignment="Top" Width="327" ItemsSource="{Binding Bookmarks}">
<ListView.View>

[Code]....

When I uncomment the MessageBox, it shows -1... This is obviously not right lol. I have the same exact click event in another class, and I obtain the items index the same exact way.. The only difference between this listview and that one is that this listview is databound.. Is that the issue? If so, how does one overcome it?

View 6 Replies View Related

C# :: How To Call Event When User Clicks A Button

Mar 25, 2014

I have a application that has a tab control and I change the font and color on form load.

But now I need to switch the font and color when I user clicks a button event.

I have 8 of these events, each customized to set different tab font and color.

tabControl1_DrawItem
tabControl1_DrawItem2
tabControl1_DrawItem3

I just do not know how to make this happen.

View 7 Replies View Related

C# :: Handling Middle Mouse Click Event

Jan 17, 2015

I'm trying to create a program which can pan by keep clicking and move the mouse

1. First, I create a class that inherited from the UserControl Class

public partial class CanvasCtrl : UserControl
protected void OnMiddleMouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Middle) {

[Code] ....

2, Second, I create the void in that class too, and write the code to get it to catch the event

public void MainMouseAction() {
this.MouseClick += new MouseEventHandler(OnMiddleMouseDown);
}

It not work, how to solve this out ?

View 8 Replies View Related

Visual C++ :: Array Of Buttons - Click Event?

Oct 15, 2012

I have successfully compiled a code where I created an array of buttons. I have added a click event to it like this :

Code:
buttons[indexofhashis2]->Click += gcnew System::EventHandler(this, &Execute::GOBUT_Click);

I have a standard event like this

Code:
private: System::Void GOBUT_Click(System::Object^ sender, System::EventArgs^ e) {
int x;
x = sender->Location.X;
}

Returns error saying Location is not a member of Object^.

I'm trying to create an array of button (user/runtime created buttons) and get different interpretations of the click event depending of wich button is clicked.

For example, if we create buttons[0] I wish to get the 0 or something relevant into the GOBUT_Click event.

View 4 Replies View Related

C++ :: Program To Simulate Customers Lining Up To Buy Tickets For Some Event

Oct 17, 2013

Create a line class using a linked list that acts as a queue (first in, first out) both enqueue and dequeue. Complete the line class so that customers can be added or removed from the line. Implement the line as a linked list of customer objects that you have developed yourself or use the vector class.

View 2 Replies View Related

C/C++ :: Implement Two Tasks Synchronized On External Event Using Mailboxes

Jan 21, 2014

I have to make a C++ program that implements two tasks synchronized on a external event using mailboxes. The first task, T1, reads integer from keyboard, and record them to a vector. The second task, T2, transforms the integer numbers in binary and shows them. External events that are synchronized tasks is typing an integer.

This is what i made so far.

#include <iostream.h>
#include <conio.h>
int v[50], n, i;long sum;
void citire(){cout<<"dati numarul de elemente al vectorului:";cin>>n;
for(i=1;i<=n;i++){cout<<"introduceti elementele vectorului: ";

[Code] ....

I don't know how to use tasks, and the program doesn't convert from int to bin..

View 14 Replies View Related

C# :: Sudoku Solver / Generator - Text Box Change Event

Feb 25, 2014

I am creating a sudoku solver/generator. I have 81 text boxes on the form. I want the form to automatically clean up the input, eliminating alpha characters, and values under 1 or over 10. Anyways I have this method written, but I really don't want to go through and type up a change method for each text box. Is there to write a method that fires when ANY text box is changed, and gets the string value from the changed text box?

View 5 Replies View Related

C# :: Programmatically Install / Remove INF Driver Through Button Event

May 14, 2014

How to install/remove an INF driver though a button click event. So far I have some code for installing the driver, however it doesn't work.

private void installDriversToolStripMenuItem_Click(object sender, EventArgs e) {
if (SetupCopyOEMInf("./PS3MCADriver/PS3_Memory_Card_Adaptor.inf", null, 0, 0, null, 0, 0, null)) {
foreach (string device in devices) {
UpdateDriverForPlugAndPlayDevices(IntPtr.Zero, device, "./PS3MCADriver/PS3_Memory_Card_Adaptor.inf", 0, false);

[Code] .....

View 14 Replies View Related







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