Advertisement
2002C Custom Controls/ Forms/ Menus #9265

Access Stuff From Other Forms

This just shows how to access CommandButton's, Label's etc.. from another Command or label. So when you click Form1's Command, you can actually be clicking Form2's command. Very useful for shortcuts.

AI

Resumen de IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fuente
original-source
'So you have your 2 forms? Good. 
'Use the code below in the specified 
'areas...

  Private Sub Command1_Click()
    Form2.Command1.Value = True
  End Sub

'That goes in form1's command button. Just add an action to the command button on form 2 to work it!
/*##############################################################################
CharsetConversion.cpp
Description: Ascii<->Unicode conversion functions
Author: Eugene Ciloci (ciloci@sympatico.ca)
Last Modified: Sat Mar 30 02:07:54 2002
##############################################################################*/
#include <string.h>
#include "CharsetConversion.h"
/*------------------------------------------------------------------------------
Purpose: Convert an Ascii string to Unicode
Parameters: [in] szAscii - Ascii string to be converted
		[out] szUnicode - Unicode string to receive conversion
On Success: szUnicode contains converted string.
		Returns true
On Error: false if either string is NULL
------------------------------------------------------------------------------*/
bool AsciiToUnicode(const char * szAscii, wchar_t * szUnicode)
{
	int len, i;
	if((szUnicode == NULL) || (szAscii == NULL))
		return false;
	len = strlen(szAscii);
	for(i=0;i<len+1;i++)
		*szUnicode++ = static_cast<wchar_t>(*szAscii++);
	return true;
}
/*------------------------------------------------------------------------------
Purpose: Convert a Unicode string to Ascii
Parameters: [in] szUnicode - Unicode string to be converted
			[out] szAscii - Ascii string to receive conversion
On Success: szAscii contains converted string
		Returns true
On Error: false if either string is NULL
------------------------------------------------------------------------------*/
bool UnicodeToAscii(const wchar_t * szUnicode, char * szAscii)
{
	int len, i;
	if((szUnicode == NULL) || (szAscii == NULL))
		return false;
	len = wcslen(szUnicode);
	for(i=0;i<len+1;i++)
		*szAscii++ = static_cast<char>(*szUnicode++);
	return true;
}
Comentarios originales (3)
Recuperado de Wayback Machine