|
No, this won't work because DirectX isn't used to play video in all cases. There is simply no reliable way to tell when video is being played by any player.
And changing screen resolution is a VERY bad idea. If you change the screen resolution, the icons on the desktop get rearranged. Messing with system-wide settings for a single application is considered very bad practice.
-- modified at 8:15 Thursday 10th August, 2006
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave for your reply.
|
|
|
|
|
hi
i have a package developed in vb.net.how can i deploy the embeded crystal report of my project to the client machine using vb.net code?when ever i ll run my program in client machine it will ask for the login information from registry.bt from that registry value,how can i set the login information of reports that i already ve been developed in another machine having different server,password & database name.please explain it with an example
u can send me the source code at pradipta_pkc@indiatimes.com
any suggestion in this regard will be highly appreciated
thanking u all in advance
i m pradip kumar from india,working in vb.net & asp.net
|
|
|
|
|
How can I populate a Treeview from Ms Access database which contains tables of :-
1. Parent (parent_id, parent_name)
2. Child (child_id, child_name)
3. ParentChildRelation (id, parent_id, child_id)
The reason that I cannot use single parent-child table is I have child with multiple parents and parent with multiple child (M-to-M). How do I solve this in populating a treeview? Any sample demo with source code?
|
|
|
|
|
I have done something similar to this.
I made one table that contained the data I wanted all in one table, all in order. The data had a three level hierarcy (Parent - 1, child - 2, grandchild -3). So when I looped through the table I would check the level and create a node accordingly.
Private Sub PopulateNavigationTree()<br />
TopicTreeView.BeginUpdate()<br />
<br />
TopicTreeView.Nodes.Clear()<br />
<br />
Dim parentNode As TreeNode<br />
Dim childNode As TreeNode<br />
'Dim fullPath As String<br />
<br />
Dim iLevel As Integer = 0<br />
<br />
Dim baseNode As TreeNode = TopicTreeView.Nodes.Add("Topics")<br />
<br />
' init to valid values for safety<br />
parentNode = baseNode<br />
childNode = baseNode<br />
<br />
Dim myRow As DataRow<br />
If m_TreeDataSet.Tables.Count > 0 Then<br />
If m_TreeDataSet.Tables(0).Rows.Count > 0 Then<br />
<br />
For Each myRow In m_TreeDataSet.Tables(0).Rows<br />
iLevel = CType(myRow.Item("Level").ToString, Integer)<br />
If iLevel = 1 Then<br />
parentNode = baseNode.Nodes.Add(myRow.Item("Topic").ToString)<br />
ElseIf iLevel = 2 Then<br />
childNode = parentNode.Nodes.Add(myRow.Item("Topic").ToString)<br />
Else<br />
childNode.Nodes.Add(myRow.Item("Topic").ToString)<br />
End If<br />
<br />
<br />
Next<br />
End If<br />
<br />
Else<br />
' TO DO: add error message here<br />
End If<br />
TopicTreeView.CollapseAll()<br />
baseNode.Expand()<br />
TopicTreeView.EndUpdate()<br />
End Sub<br />
|
|
|
|
|
Hi,
almost done with my project (I thought...)
functionality is 100%, but I don't wanna put "best viewed on MY computer" on the bottom of the page...hehe
But when I try to view it in 1024*768 it looks awful...
And 800*600 is even worse (so bad u couldn't even click some of the buttons)
I need help, and general tips on how I can now modify things to fit for crappy resolutions (=> 1024*768 and 800*600)
I had been using absolute positions..
Now I've come to the conclusion I need to use pixels for text sizes...
The goal I think would be to get it to fit PERFECT for 1024 at least, and 800*600 users should be used to crap anyway...
(although I would like it to be usable for them too, this is a professional app and I cannot say "bha f' em")
Just not sure how to get on with this, any general tips or links will be very appreciated...
Please help..?
|
|
|
|
|
Smaller resolutions can be hard to work with. Usually it something that is part of the requirements up front, you work out what resolutions your users have and find some compromise resolution you agree to work toward.
How much of your screen is in absolute positions? Could you rearrange things so some sections are fixed and others able to be resized, like the codeproject front page which has two fixed columns and a centre column that is resizable? This pattern works well with a variety of resolutions.
|
|
|
|
|
I have to make sure it looks perfect for 1024 (*768) which I THINK is the most common... (stressing think cos it seems like a horribly small res to me..)
But since I worked with absolute positions in my main frame (top frame is title, log off button, etc; left frame is menu):
my main problems are:
I want the menu frame to fit no matter what (I'm guessing pixels is the way then, using the text of longest menu item and just testing out...)(the easy part)
Now on main frame, lots of things happen, datagrids, trees, buttons, etc, everything..
But when I tested on 1024 or 800, some buttons are under labels (unclickable), and u need to scroll to left and right an awful lot...
My main concern is making sure NOTHING EVER crosses (like my labels and buttons)...
What would be the best way to make sure of that? Positioning??
(I recently migrated from classic asp to .net and always refused to use "design view"; this is my first time creating a web app with design and my phobia of it is far from cured after this experience...)
|
|
|
|
|
Mainly I have worked with tables for organising layout. Tables could help you with ensuring that sections do not overlap.
For the menu you might find some sample html menus online that could help.
|
|
|
|
|
Thx for replies,
I was afraid I would have to use tables... :/
I guess it's the best way...
For menu, I already like mine (really cool :P)
Just not sure how to set up the left frame so it fits menu on all resolutions...
Unless some1 has a better idea, I'm going to work my way to the right pixel width so it fits perfectly for 1024, and not so bad if the little arrows are not showing for 800*600 users, and anyone over 1024 has room enough for a little extra margin after menu (looks better too)
Again, thx for replies, very nice.
-- modified at 4:38 Thursday 10th August, 2006
Actually, just moving my visual studio window from 1 screen (high res) to another (low res), and making sure it fits both...
|
|
|
|
|
Using VB.NET I have defined a class (the first of many to come if it works). Inside the class I have
Public Function Init()
Inside the Init funtion I would like to change the caption of some of the objects on the form. Likewise, I would like to fill a combo box with class specific information.
What I can't figure out is how do I refer to an object on the form in order to change its caption, or fill the contents of its combo box?
In my example I have a button called Test1. If I add inside the Init() function Test1.Text="My test", it doesn't know what to do with it. Since I could do this in VB6, I'm sure there must be a way to do it. I just don't know the proper method.
Can anyone tell me the secret?
Thanks,
Ilan
|
|
|
|
|
The controls are members of the form class, you need a reference to the instance of the form to reach the controls in it.
You can either send along a reference to the form, or a reference to the specific control, to the method. I would suggest the later, so that the method doesn't have to be bothered with the name of the control.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for the help, but I'm still too new to understand exactly what you are saying.
If I write "Form1" it comes up with a list of suggestions like ActiveForm etc. which don't look like they will help.
If I type Form1.Test1.Text="my Test", it doesn't know what I'm talking about.
How exactly do I get the reference to the instance of the form? Is there something like GetParent()? This is probably trivial to you, but I'm missing the link.
Thanks,
Ilan
|
|
|
|
|
You suggest to send along a reference to the form. How do I do this?
In the form where the class is called do I do something like
myScope.Init(this)
where Init is defined something like
Public Function Init(CWnd* wnd1)
(I know the syntax must be wrong but I'm used to c++.)
Preferably I'd like the class to know something about Form1 without my having to explicitly send something, but if I must send it explicity, please give me the exact syntax in order to do so.
Thanks,
Ilan
|
|
|
|
|
You don't have to specify when you use pointers/references in C#. All objects are always handled using references. You should specify the data type of the return value from the function, though.
Public Function Init(Form1 mainForm) As String
Now you can call it from Form1:
result = myScope.Init(this)
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your help.
I think you got slightly confused as to who changes who.
I want the function to change the form.
In any case your help was enough to get me going. It doesn't recognize 'this', but on the other hand it knows what 'Me' is. Likewise it doesn't know what 'Form1 mainForm' is but it does know what 'ByRef mainForm As Form1' is.
As far a return values, I return a simple status value and apparently it has no troubles with integer return values. Something more complicated like a string would most likely demand your syntax.
In any case I used:
Public Function Init(ByRef mainForm As Form1)
Dim stat As Integer = DS_SUCCESS
mainForm.Test1.Text = "my Test"
and I called it by
stat = myScope.Init(Me)
and it finally changed the button text. (Not that I really want to change that button's text, but I do want to know how to change other things on demand.)
Do you know if I could save the value of mainForm in my class in case I need it outside of the Init function? I could make it a class variable, but the question is if it could change? My gut feeling is that it wouldn't change since it is the main form.
Thanks again,
Ilan
|
|
|
|
|
You can save the value of mainForm in your class as a class variable.
If the mainForm is the first form that is created and the last form that closes then it will not change.
|
|
|
|
|
That is nice and all, but completely bad practice in an Object Oriented language.
You're other class is now forever tied to this form and only this form. You'll never be able to reuse it in any other project, or even any other form, unless it's built speicifically with this class in mind.
Any code that changes the form should remain in the form's code, not in a seperate class. The form's code is responsible for updating the UI it's showing. If your class has to return a value that changes the form, the form code should be evaluating that return value and making any necessary changes. Keep the UI code in the UI layer, not the business layer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave. You are right. I have very little experience with Visual Basic so it was a struggle to get ANYTHING to work. However since I'm at the start it should be fairly easy to change it to return things to the form and have the form make the changes.
Ilan
|
|
|
|
|
IlanTal wrote: I think you got slightly confused as to who changes who.
I want the function to change the form.
No, I'm not confused about that.
IlanTal wrote: It doesn't recognize 'this', but on the other hand it knows what 'Me' is. Likewise it doesn't know what 'Form1 mainForm' is but it does know what 'ByRef mainForm As Form1' is.
Right. I'm only programming C# myself, so I mixed up the syntax a bit. Sorry for that.
There is no reason to specify ByRef for the reference, though. You are not going to replace the main form with a completeley new form in the method, are you?
IlanTal wrote: Do you know if I could save the value of mainForm in my class in case I need it outside of the Init function? I could make it a class variable, but the question is if it could change? My gut feeling is that it wouldn't change since it is the main form.
Yes, you could. The reference to the main form won't change as long as the form is open.
However, as I suggested before, I reccommend that you just send a reference to the control that the method is going to change. That way it's obvious what the method is going to update, and as the method isn't locked to a specific control you might be able to use the method for more than one control.
---
b { font-weight: normal; }
|
|
|
|
|
i use data grid to show my main information from ADODC,
but i wanna add a function on when user click on the selected line on data grid, the sub information will show at the other list view or data grid...
is it better to show in data grid or list view for the sub catagory?
Exmaple,
MY recent Datagrid show the receipt No. when user click on it, the list of item will show out for that specific Receipt no.
|
|
|
|
|
campbells wrote: is it better to show in data grid or list view for the sub catagory?
it all depends on the requirement.. Datagrid is good option if you are going to edit that information or even for Viewing only. ListView is good for viewing only not for editing.
|
|
|
|
|
do u know how to command on when specific record was click then it will show the sub category ??
i have show my information in the data grid ,now i want to show it sub information when the data grid record was selected..
|
|
|
|
|
How do I create a custom control with a datasource that populates its dropdown with the list of available datasources? There is no dropdown.
|
|
|
|
|
This seems to be the answer:
<category("data"), _
="" attributeprovider(gettype(ilistsource)),="" _=""
="" refreshproperties(refreshproperties.all),="" browsable(true)=""> _
Public Property DataSource() As Object
...
End Property
I earlier had it coded AttributeProvider("IListSource")
|
|
|
|