Visual C++ :: Working With More Than One Form?

Sep 27, 2012

I'm currently trying to work with more than one form, but I didn't succeed yet. What I need is quite simple: Once the program runs, a small form appears first asking "what would you like to do" with corresponding buttons for each option. Each button loads a new different form for a different task. So basically I need to open and close forms, also having two forms loaded at the same time (pop-up style) would be great for certain purposes.

I still haven't figured how to do it properly. I'm currently using VC++ 2008 and my project is a Windows Forms Application.

View 5 Replies


ADVERTISEMENT

Visual C++ :: How To Pass Value From One Form To Another

Mar 12, 2013

i am trying to create a form app with multiple forms. there is a form i'm using as "search". i want to take the value of the textbox in search-form and pass it to another form which shows the result of the search. i've tried to include search-form.h in the form of the result but it returns an error.

Code:

String ^ key;
key = searchbox->Text;
std::string ks = marshal_as<std::string>(key);
ks=ks+".bin";
ifstream sfile(ks);
if (sfile) {
PatInfo ^ form = gcnew PatInfo;
form->ShowDialog();
} else {
MessageBox::Show( "Please try again.");
}

to conclude, i want the form PatInfo to open an receive the "ks" var.

View 4 Replies View Related

Visual C++ :: Developing A Form Application?

Jan 15, 2014

I have a HTML code and i need to developing a form application.

issue: i have a html code and a database table , how to put this together with code and link them and peu them on server ...

View 3 Replies View Related

Visual C++ :: Compare Two Strings To See Difference In Int Form

Apr 2, 2013

I want to compare two string, and want to see differeince in int form. For example,

Code:
string first_string="0002AE1";
string second_string="0002AE2";

How can i calculate difference between two string? It is obvious difference between above two string is 1/-1, but difference would be 1.

View 2 Replies View Related

Visual C++ :: Allow User To Enter A Value As C String In Certain Form

Oct 14, 2013

My program was to allow the user to enter a value as a C string in the form: xxx,xxx,xxx,xxx,xxx.xx, where x can be any digit. Well, so far here is my attempt. I think the question is, would I have to implement a switch statement for the digits, the comma, and the decimal, so that when a user inputs, let say 52,000.00 the switch statements would read the 1st digit, checks for decimals/commas and if not, proceed to read 2nd digit, and repeat?

Code:
#include <iostream>
#include <string>
int main() {
using namespace std;
char buffer[256];
char tempBuff[256] = {'

[Code] ....

View 3 Replies View Related

Visual C++ :: Converting Code To CLI Form Application?

Jun 10, 2013

As a starter project I want convert a Neural net app from "AI Techniques for Game Programming (2002 Buckland)" to a Visual C++ CLI Forms application. I have created the interface and now I have to rewrite the in/output routines, amongst other things.

First question I have has to do with variable initialization used by Buckland. Code looks like this:

Excerpt from header file (CNeuralNet.h):

//-------------------------------------------------------------------
//define neuron struct
//-------------------------------------------------------------------
struct SNeuron
{
//the number of inputs into the neuron
int m_NumInputs;
//the weights for each input
vector<double>m_vecWeight;

[code]....

Question I have: what is the the function of ": m_NumInputs(NumInputs+1)" after the method declaration? Buckland does this in many places in his code. In this case it's a struct, but he does it with classes too.

View 3 Replies View Related

C Sharp :: Create Instance Of Form Into Non Form Class To Access Button / Label

Nov 23, 2014

I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?

View 4 Replies View Related

Visual C++ :: Windows Form - Create Method With Parameters

May 16, 2013

I am wanting to separate the logic from the visual, but I'm having problems when calling the method that controls the actions of the progress bar timer.

Code:

ifndef PROGRESS_BAR
define PROGRESS_BAR
class Progress_bar{
public:
void set_Progress(ToolStripStatusLabel^ label,Timer^ time){

[Code] ....

The way that I'm calling this method on Form1.h

void set_Progress(toolStripStatusLabel1 ,timer1);

Errors:

Error1error C2182: 'set_Progress' : illegal use of type 'void'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277
Error2error C2078: too many initializersh:cry_devprogrammingc++school_mediaschool_mediaForm1.h277
Error3error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Timer ^' to 'int'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277

View 3 Replies View Related

Visual C++ :: Create Window Form Function Using MFC Or Win32 API?

Jan 7, 2013

My setup is as follows:

There is function written C++, that must be compiled to DLL. This DLL is linked to some CAD (computer aded design) tool, that has special interface for it.

I want to add to this function some GUI (graphical user interface). So the creation of a window is necessary.

I've tried already with Win32, but without success.

The problem is that CreateWindow function requires application instance handle, that is provided by Windows itself when window is created in "normal conditions".

View 14 Replies View Related

Visual C++ :: Declaring Member Variables In Windows Form App

Sep 30, 2014

I have created a windows form project in visual studio so that I can use a windows form to interact with the game class that I'm creating, but I'm running into some problems.

For one thing, I would like to be able to call Image::FromFile() one time only during initialization, and store the result in a member variable (called mBGImage). From what I can tell, the variable needs to be of type String^ (this caret symbol is new to me, but I understand it is the "managed code" version of the standard pointer, which would look like String*).

When I try to compile the following code (located in my header file) I get the error :

"error C3265: cannot declare a managed 'mBGImage' in an unmanaged 'BSG::BSGame'".

How can I store the result of Image::FromFile() permanently in my class?

When I try to declare a global variable of type "Image^", I get "error C3145: global or static variable may not have managed type System:rawing::Image ^"

#include "stdafx.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;

[Code] ......

View 2 Replies View Related

Visual C++ :: FloodFill Is Not Working

Jan 21, 2014

FloodFill is not working. I am using Visual C 6.0 in windows 7 environment. Its not filling a triangle.

My code is:

Code:

void CFloodFillExView::OnDraw(CDC* pDC) {
CFloodFillExDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPoint Pt[7];
Pt[0] = CPoint(300, 400);
Pt[1] = CPoint(200, 300);

[code]....

View 9 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# :: Login Then Close Form And Open Main Form

Aug 25, 2014

This is more of a Application Design question, Let's say I have Form1(Login), this is opened from Program.cs, when the user enters details, the Event Handler makes a instance of a class, adds the data and stores the instance within Program.cs class.

So the best thing to do here, is to close the Form1(Login) and open Form2(Main) via Program.cs so that I can send the List<Login> object with my Login instance objects to said form. This form will remain open throughout the applications use as it's like the main GUI for all the programs functions.

When I close this form, I may want to save some information before the application is terminated, so I may as well store the Login instances in Program.cs anyway.

Main stepping stone: Multiple (usually around 3 max) users can login this system if need be, which will mean closing Form2(Main) and then opening Form1(Login) so that once Form1 is closed it can recreate the From2(Main) form and pass the new List<Login> to that form.

What's the best way to do this, at the moment i'm creating the Form2 instance like so:

//....
//Detect the Login form being closed
loginForm.Closed += new EventHandler(OnLoginClosed);
//...
//Open the main form when the login is closed
private void OnLoginClosed(object sender, EventArgs e)

[Code] .....

This seems like it will work and do the job, but is there a better and cleaner way? The List<Login> will be passed to Forms which are created via Form2(Main) as this information will be needed. It's just that ive been told not to use Forms for too much data containment.

View 2 Replies View Related

C# :: Windows Form Application Using Visual Studio To Fetch Data From Web?

Aug 19, 2014

I want to write my own application which would fetch some data from a web site. I need to parse the HTML code of the web site and get the data.

About the application:A form (main form) that will contain data arranged in rows. Some of the data comes from a web site and some of it comes from a database.The data that comes from the web site needs to be updated every few seconds so I need to keep fetching the data from the web site.The main form will contain a button "add" which when clicked will add a new row. New data can be added to this row by the user.

I am not sure what to use for this. I have been writing the application as a Windows Form Application (Visual C#) but I do not know whether this is the best choice. Should it be a windows form application or web application? Should I use something else?

View 6 Replies View Related

Visual C++ :: Dialogue Box Button Not Working

Feb 3, 2013

Dialogue box in the program is displayed but button will not respond. I created dialogue box using resource wizard,

Code in Resource.rc for dialogue box is generated as below

IDD_DIALOG1 DIALOGEX 0, 0, 131, 69
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Test dialogue"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "That is Good",IDOK,30,35,66,25

[Code] .....

View 14 Replies View Related

Visual C++ :: Slider Not Working Properly In A Dialog MFC?

Jul 3, 2013

I have a slider control on a dialog box. I am playing a video file and slider moves according to the video elapsed. Suppose I have set the slider range to 100. Now till some point say 90, the slider moves to the point wherever I click the mouse. but at the last point in between some range say 90 - 100 (to the end of the slider), if I click the mouse button anywhere, slider jumps to the end.

I am using a TimeLine control where user can add more than 1 video (1, 2, 4, 8, 10 , 50 etc......), If I use only one video, slider moves as per the video progression.....Issue arises when I add more than 1 video and click on the start button, slider starts moving....Now when I drag the slider to any position or I click the mouse button anywhere on the slider control, slider thumb moves to that position and immediately jumps back to some other position. This is the Issue, I am facing.

share some sample code where slider is moving with the video showing the progress of the video.

I want to implement a functionality similar to VLC player. Wherever user clicks the mouse, slider moves to that point.

View 13 Replies View Related

Visual C++ :: Totals Or Formula To Calculate Is Not Working?

Sep 19, 2014

My code is below:

Total Interest ends up as my last Monthly Payment amount instead of adding up all Interest Paid - What am I doing wrong?

Total Paid isn't calculating correcly either - What am I doing wrong?

I suspect both are very similar problems. I've tried several different calculations, but cannot figure this out.

#include <iostream>
#include <cmath>
using namespace std;
double GetMonthlyIntrest (double OpenBalance,double rate);
bool ContinuePgm();
int main () {
double StartingBalance,rate,amount,OpenBalance,IntPmt,TotalInt=0.0,GrandTotal=0.0;

[code]...

View 3 Replies View Related

Visual C++ :: CDHtmlDialog Not Working With CSS Media Queries

Feb 21, 2014

I have a CDHtmlDialog app in which am trying to add a CSS media query in the HTML file as shown below, but it doesn't work.

@media (max-width:20em) {
table, thead, tbody, tfoot, th, td, tr { display:block; }
tr + tr { margin-top:1em; }
}

The same CSS works fine if i open in a browser like IE, FireFox, Chrome. But inside the CDHtmlDialog app this doesn't work.

I am using Visual Studio 2012 for development and have IE 11 installed in my machine.

View 1 Replies View Related

Visual C++ :: Converting ASCII To CString Not Working In 6.0?

Sep 22, 2012

The below code is working fine in VS2008 and not working in VC6.0 (taking garbage values) this code is for converting hex values to string.

sending Input string is : 727332333263 required output: rs232c

DWORD AsciiToString(LPCTSTR f_chInputChar, LPTSTR f_chOutputChar) {
long ch;
int i,j;
TCHAR tmp[2];
int len = _tcslen(f_chInputChar);

[Code] ....

View 5 Replies View Related

Visual C++ :: OnSize Handler Not Working As Expected

Nov 6, 2013

I keep having problems with CMFCPropertySheets. I now have it embedded in a resizable dialog and the property sheet and page gets resized when dialog is resized all that is working fine.

Problem is OnSize is being called when the dialog is being resized NOT when it has finished resizing so the values reported in cx and cy is the old size not the size AFTER resizing. What could be causing this? Isn't OnSize call AFTER the size has been changed and OnSizing called WHILE the size is being changed?

I have a list control that needs to take up full rect in each page and when the dialog is maximized it stays at previous size even though the sheet and page have both maximized as they should.

I ran a trace on the OnSize even for both the sheet and page and OnSize is being called during the sizing and not after it has already been sized like it is supposed to.

View 6 Replies View Related

Visual C++ :: Find To Look For Variable Stops Working?

Oct 3, 2013

Just using Find in my source code to look for variables or whatever, works once or twice then just stops - Doesn't find anything even if it's there. If I restart VS it works again, but not for long.

View 1 Replies View Related

C# :: Sharing Variables From Login Form To Another Form

Mar 10, 2015

I have a form with 2 text boxes (Email and Password)

The user fills in the text boxes and clicks on the Log in button. The code behind the log in button does the following, First connects to a table (Users) in phpmyadmin. Next runs a SQL query (SELECT * FROM `users` WHERE Email = '" + sEmail + "' AND Password = '" + sPassword + "'") sEmail being the variable created from the text entered in Email text box and the same for password.

Next if the record count == to 1 it opens up the main menu form and if the record count == 0 it fails and the user does not get to the main menu.

All of the above is fine and working however what I want to do is take over a variable from the log in form to the other forms.

The code is below for the sign in button as all my code is behind that (I think this may be where I'm going wrong).

public partial class WelcomeForm : Form{
public static string connStr = "server = localhost; " +
"database = ppw5; " +
"uid = James; " +
"pwd = buster;";

[Code] .....

And the Main menu form where I'd like to take a variable over with me, lets assume the variable is the UserID from the database table that I pull from the dTable I created.

public partial class MenuForm : Form {
//Call the CloseProgram class and create a new method called ClassClose.
CloseProgram ClassClose = new CloseProgram();
WelcomeForm User = new WelcomeForm();
public MenuForm() {
InitializeComponent();

[Code] .....

View 7 Replies View Related

C Sharp :: How To Code Array In Windows Form Using Listview In Visual Studio 2008

Oct 5, 2013

This is my problem in my subject programming but i dont how to use Array in windows form ... If i run my code i want my Data in listview would not be disappear if i close the form ...?

View 1 Replies View Related

Visual C++ :: How To Assign Const Char Return Value Of A Function To Label In Windows Form

Sep 30, 2013

I am a newbie to C++ and VS ++. I have created a windows form application by dragging and dropping button, label..etc. i wish label text to be appeared as return value from a function. The function returns ' const char* '.how this returned string pointer can be used to display label text.?

View 9 Replies View Related

C++ :: Keyboard Shortcuts Not Working In Visual Studio 2013

Feb 6, 2015

I downloaded Visual Studio 2013 on a new laptop. On my old one I could press things like ctrl + F7 to compile and ctrl + F5 to start without debugging however now it isn't responding when I type those commands. Nothing happens at all. How to change this? I googled "keyboard shortcuts not working in Visual Studio 2013" but per the usual Google comes up with garbage search results that do not pertain at all.

View 1 Replies View Related

Visual C++ :: Tooltips Not Working For All Controls In CFormView Derived Class

Sep 16, 2014

I can't get tooltips to show up for the windows I want in my CFormView derived class. I have copied the code from the MSDN entry on EnableToolTips(). But only two windows respond with a tooltip:

CONTROL "Tree1",IDC_TESTPLANS,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,1,36,85,91
CONTROL "Tab1",IDC_TABCMD,"SysTabControl32",0x0,101,0,239,181

Other windows do not respond. For these windows my function designed to catch the TTN_NEEDTEXTW and TTN_NEEDTEXTA messages is not called. Windows such as

LISTBOX IDC_TESTPLANNAMES,0,119,48,40,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_BTN_COPY,105,177,24,24,BS_ICON

Why wouldn't the messages be sent for those windows? I'm using the code

ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)

(CCntrlView is the name of my class derived from CFormView.) And as I pointed out, I'm using the code straight from the example given in MSDN for CWnd::EnableToolTips(), with the only difference being that all my controls are created in the rc file as shown above.

View 12 Replies View Related







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