|
Thankyou for replying Dave. This is turning into a very interesting discussion. You are correct in your initial statement. I can see its a very bad way of programming, but also a very simple way of getting a job done quickly.
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.
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.
There's no event triggered within childwindow2, so therefore its textbox will not refresh with the new data.
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.
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?
Look forward to your reply.
Andy
|
|
|
|
|
Just add some events to that datastore class. Perhaps have it (the datastore class) raise events that each of your tabs can monitor. They must, afterall, be aware of the class that is holding the data. Why not make them aware of events in that class that tell anything that sets or retrieves data from it what is going on.
That should work with your mdi form example also if I'm not mistaken.
Beaniiman
|
|
|
|
|
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
|
|
|
|
|
Well, what can I say? Thankyou Dave, and Beaniiman.
In such a small thread, I've learnt alot about design techniques and how I should code differently.
Thankyou for your input, its been extremely interesting.
Andy
|
|
|
|
|
I have an sql query like "select id, text, time from table" filling a datagrid.
i have a problem with the datagrid values in the time cell. It says that has null values or 00:00:00 value.
I don't know why. If I make the same query directly in mysql, it returns correct values.
I test the same query with a little variation "select id, text, HOUR(time) from table".This time, the datagrid shows the correct values (12, 06, etc).
Someone knows why is happening this?
|
|
|
|
|
Well, I solved the problem this workaround:
"select id, text, DATE_FORMAT(time,'%H:%i:%S') from table"
Hope this helps to somebody!
|
|
|
|
|
I created this user control that has various linkbuttons to other parts of my web application. I want to disable some of the linkbuttons so that users can't access other pages. I have tried various different ways but as of yet no joy. I have made the linkbuttons in the usercontrol.ascx public so all i really need to kno is how to disable them from the .aspx page.
Any advice is greatly appreciated.
|
|
|
|
|
hi there,
what problem u got when trying to disable linkbutton?
it's ok with me but just for asp button, not try with linkbutton yet.
<< >>
|
|
|
|
|
Basically whenever i put the line in
usercontrol.linkbutton1.enable = False
it won't set the enabled property to false.
gfhg
|
|
|
|
|
how about if u put the link button in web page not in usercontrol?
it would be better to find out the cause if u can post the snippet of code.
<< >>
|
|
|
|
|
ok below is the code for the USER CONTROL
Imports System.Data.SqlClient
Public Class Topmenu
Inherits System.Web.UI.UserControl
Public WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton
Public WithEvents LinkButton2 As system.Web.UI.WebControls.Linkbutton
Public WithEvents tbltopmenu As System.Web.UI.HTMLControls.HTMLTable
Dim conn As SQLConnection......
Public Sub Page_Load(....)
End Sub
Private Sub LinkButton1_Click(....)
Response.Redirect("menu.aspx")
End Sub
Private Sub LinkButton2_click(....)
Response.Redirect("logout.aspx")
End Sub
End Class
And this is the code I have in the Page_load event on a number of .aspx pages
Public Sub Page_Load(......)
topmenu.Linkbutton1.Enabled = False
End Sub
gfhg
|
|
|
|
|
Can anybody tell me about any control that is available on the net for converting from one audio format to another...
Thanx
|
|
|
|
|
hi there,
there are couple of articles about this on CP site. below is just one of them
http://www.codeproject.com/cs/media/Aumplib.asp
But this one is the C# one. so u need to port to VB/VB.net yourself
<< >>
|
|
|
|
|
I'm also looking for this type of ability, but in VB, as my knowledge to convert from c++ / c# is lacking.
I would like to be able to open a wave, convert the sample rate, etc, and save it out as a wave, and possibly an mp3.
Any help would be greatly appreciated.
|
|
|
|
|
How to get barcode data from Barcode Reader
thanx in advance
|
|
|
|
|
Barcode readers usually work exactly like a second keyboard. Unfortunately, you usually can't tell the difference between what is being types and what is being scanned.
That problem is easily solvable because most barcode scanners will let you specify a preamble and/or postamble so you can assume that whatever is comming between these characters is being scanned.
Your best bet is to get with the documentation on the scanner, open Notepad, then start playing with the barcodes you have to scan.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to create word/excel file in a Visual Basic Application ?
Thanks in advance
|
|
|
|
|
There's several articles in here regarding this.
Use the search to help you find them
|
|
|
|
|
hi all,
can anyone help me getting cleared with the following doubt?
i have a form with some input fields and i insert those values into a database and below the form i have a datagrid thro which i view the data which i added to the database i.e. all data that are present in the database.
but my problem is that, the data gets added but its getting repeated in viewing the datagrid.i tried using datagrid.refresh method it doesnt work . is there anyother method to view the data in the datagrid without getting repeated.kindly help me.
and i thank u in advance for ur effort.
|
|
|
|
|
Call
dataset.clear()method then call databind() method
|
|
|
|
|
Hi guys!
need urgent help...
i m developing an vb.net application. I want that during the installation of application the set up should check the pre-installed .net framework,
and if it is not present it should ask for the installation and install it if possible
Can any one help me!
abhinav
|
|
|
|
|
|
|
Hai,
I am beginners of vb.net.
I want to open word or notepad or any exe files through from the vb.net link.
How it is possible?
any body knows give some idea to me.
|
|
|
|
|
If nobody offers a better idea, this is how it was done in vb6. Perhaps you can use this as a starting point:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Dim nResult As Long, pathName As String
pathname = <whatever you like>
nResult = ShellExecute(Me.hwnd, "Open", pathname , 0, 0, SW_SHOWNORMAL)
|
|
|
|