|
I have done that already and inserted them into arrays whereby i generate an ID. I have also entered validation for a user entering more than 3 words in the textbox.
The problem occurs if a user enteres a space after the last word then the validation reads it as more than 3 words and brings up the validation message.
Thank you
Nothing lasts but nothing is lost
|
|
|
|
|
Then Trim the string before you parse it. This will remove all white-space characters from the beginning and end of the entered text.
Dim parseThis As String = enteredText.Trim()
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you
Nothing lasts but nothing is lost
|
|
|
|
|
Hi,
I want to send command to card printer through my application in VB.
Printer is connect on the parallel port with port name "ELTNLPT".
Can anybody guide me that how could I send the following command from
my application in VB?
&E1 639357000000001^SHARIQ ZIA^0909
This is the command to write Track 1 information on the magnetic stip
of card.
Urgent reply will be highly appreciated.
Thanks,
Shariq Zia
|
|
|
|
|
Hi,
Is it possible to populate a combo-box from an excel sheet using Vb.net
thanks
|
|
|
|
|
yes. You need to read the data from the excel file and populate the combo box.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
Could anyone tell me how to detect the play of a video file (any video file like AVI, WMV, MPEG etc...)?
If any application (like RealPlayer or Windows Media Player) plays the video file, my application should recieve a notification.
Thanks in advance,
Pavan
Regards,
Pavan
|
|
|
|
|
There's no way to do this. There is no notification event that gets fired by anything when a video file is played.
What are you trying to do with this?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks a lot for your reply.
Purpose: On detecting a video play, I have to set the preferred resolution of the screen automatically for the best view.
Can we hook on directx dll and try to get a notification when DirectX starts Rendering Video?
I heard of injecting code into third party DLL's but I have never worked on it. Will this idea work out for detecting the video play?
Please help me.
Regards,
Pavan
|
|
|
|
|
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
|
|
|
|