Click here to Skip to main content
15,899,314 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Return the filename of an image in a picturebox Pin
Dave Kreskowiak13-Sep-05 5:58
mveDave Kreskowiak13-Sep-05 5:58 
QuestionFinding my mummy Pin
Mark0613-Sep-05 1:27
Mark0613-Sep-05 1:27 
AnswerRe: Finding my mummy Pin
Dave Kreskowiak13-Sep-05 4:22
mveDave Kreskowiak13-Sep-05 4:22 
GeneralRe: Finding my mummy Pin
Mark0613-Sep-05 5:58
Mark0613-Sep-05 5:58 
GeneralRe: Finding my mummy Pin
Dave Kreskowiak13-Sep-05 6:26
mveDave Kreskowiak13-Sep-05 6:26 
GeneralRe: Finding my mummy Pin
Mark0613-Sep-05 10:42
Mark0613-Sep-05 10:42 
GeneralRe: Finding my mummy Pin
Beaniiman13-Sep-05 12:05
Beaniiman13-Sep-05 12:05 
GeneralRe: Finding my mummy Pin
Dave Kreskowiak13-Sep-05 12:44
mveDave Kreskowiak13-Sep-05 12:44 
andymknight wrote:
but also a very simple way of getting a job done quickly.

If it's not done right, it's not done. It's just hacked togther and "works".


andymknight wrote:
Your right, creating a class to encapsulate the data would be perfect. But this is triggered by an event within tabpage2, ie: its own activation. Primarily because its hidden until the user clicks on its tab.

Yep. Remember, the user interface was not meant to store the data, just display it and process input.



andymknight wrote:
What if the trigger occurred somewhere else?

Lets imagine for a moment that they are not tabpages, but infact child windows, side by side, within an mdi form.

The user fills in a value into a textbox in childwindow1. But childwindow2 is still visible on the screen, next to childwindow1.


That's a hacked example. An MDI interface was meant to have Multiple Documents using the same editor. Not have multiple pages open all modifying the same data. If you've got this situation, you really have to rethink your data model.


andymknight wrote:
The user fills in a value into a textbox in childwindow1. But childwindow2 is still visible on the screen, next to childwindow1.

There's no event triggered within childwindow2, so therefore its textbox will not refresh with the new data.


There will be if, like Beaniiman said, the data class raises events that say "such-and-such" changed! Ever look at the events of various controls? Same exact thing. If you change a property in a control, an event fires off, usually by the name PropertyChanged.


andymknight wrote:
If each childwindow knew who its parent was, childwindow1 could raise an event and cause a cascading situation until childwindow2 got updated. But that could get very messy.

Maybe a timer in childwindow2 to check the class for any changes? Again, horrible and messy.


Messy? That's why no-one worth their weight does this!


andymknight wrote:
This still returns to my original question. If a child is not aware of any other siblings and their events, its only link is the parent?

Beaniiman beat me to it, but your data class can expose its fields as Properties. Then when TabPage1, or ChildForm1, changes anything in the dataclass, the Property code fires a PropertyChanged event. Any subscribers to the event, like TabPage2 or ChildForm2, get notified of the change and can update themselves with the new value. Notice, this still follows the model of various visual elements maintaining their own little part of the dataset.

There is nothing that says a data class can't fire it's own events when a field in the data class changes.


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: Finding my mummy Pin
Mark0613-Sep-05 13:17
Mark0613-Sep-05 13:17 
QuestionVBNET, mysql and time field error Pin
ecentinela13-Sep-05 0:41
ecentinela13-Sep-05 0:41 
AnswerRe: VBNET, mysql and time field error Pin
ecentinela13-Sep-05 1:50
ecentinela13-Sep-05 1:50 
QuestionDisable User Control Pin
mcgann12-Sep-05 22:58
mcgann12-Sep-05 22:58 
AnswerRe: Disable User Control Pin
enjoycrack13-Sep-05 0:03
enjoycrack13-Sep-05 0:03 
GeneralRe: Disable User Control Pin
mcgann13-Sep-05 2:07
mcgann13-Sep-05 2:07 
GeneralRe: Disable User Control Pin
enjoycrack13-Sep-05 21:51
enjoycrack13-Sep-05 21:51 
GeneralRe: Disable User Control Pin
mcgann13-Sep-05 22:49
mcgann13-Sep-05 22:49 
QuestionAudio Format Conversion Pin
Mr. Naveed Butt12-Sep-05 21:09
professionalMr. Naveed Butt12-Sep-05 21:09 
AnswerRe: Audio Format Conversion Pin
enjoycrack13-Sep-05 0:14
enjoycrack13-Sep-05 0:14 
AnswerRe: Audio Format Conversion Pin
jmachacek13-Oct-05 4:46
jmachacek13-Oct-05 4:46 
QuestionBarcode Reading in VB Pin
kk.tvm12-Sep-05 21:00
kk.tvm12-Sep-05 21:00 
AnswerRe: Barcode Reading in VB Pin
Dave Kreskowiak13-Sep-05 2:40
mveDave Kreskowiak13-Sep-05 2:40 
QuestionCreating Word/Excel files in VB Pin
kk.tvm12-Sep-05 20:58
kk.tvm12-Sep-05 20:58 
AnswerRe: Creating Word/Excel files in VB Pin
Mark0613-Sep-05 4:18
Mark0613-Sep-05 4:18 
Questionhow to refresh the datagrid? Pin
Anonymous12-Sep-05 20:43
Anonymous12-Sep-05 20:43 
AnswerRe: how to refresh the datagrid? Pin
Anonymous12-Sep-05 23:15
Anonymous12-Sep-05 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.