|
Something like this:
Private Function checkCbos() As Boolean<br />
Dim myControl As Control<br />
<br />
For Each myControl In Me.Controls<br />
If TypeOf myControl Is ComboBox Then<br />
If myControl.Text = "" Then<br />
'Set error provider<br />
errorPro.SetError(myControl, "Do not leave the factor box empty!")<br />
'Return False and exit to calling procedure <br />
Return False<br />
Else<br />
'Clear the error provider<br />
errorPro.SetError(myControl, "") <br />
End If<br />
End If<br />
Next myControl<br />
<br />
'If code gets to here, no combo's text is ""<br />
Return True<br />
<br />
End Function
Steve
|
|
|
|
|
Thanks Mike and Steve,i got the point, that is very helpful.
|
|
|
|
|
Hi Steve, ur code only checks a single combox and returns false if the control text is empty. I add a integer to count, and make sure all the boxes are checked. Add 1 if it is not empty.
Private Function checkCbos() As Boolean
Dim myControl As Control
Dim count As Integer = 0
For Each myControl In Me.Controls
If TypeOf myControl Is ComboBox Then
If myControl.Text = "" Then
'Set error provider
errorPro.SetError(myControl, "Do not leave box empty!")
'Return False and exit to calling procedure
Else
'Clear the error provider
errorPro.SetError(myControl, "")
count += 1
End If
End If
Next myControl
'If code gets to here, no combo's text is ""
If count = 6 Then
Return True
Else
Return False
End If
End Function
|
|
|
|
|
Well, it will check all combo boxes but only return an error for one at a time.
Presumably you call checkCbos() in your Save button 'click' procedure?
The function will set an error provider on the first combo box that contains "" and then exit the function. If you select an item and then click your Save button again, you will be notified of any further combos containing "".
This way, if you added another combo box at any time, the code will still work.
The way you have done it is fine but would fail if you added another combo at any time. If it works for you though, that's great!
Steve
|
|
|
|
|
I am working on project... Like a shell and my question is.
Is it possible to turn off windows keys like (WinKey+D), (Winkey+S),etc.
And other that can stop application. Its a program like a desktop and u can only use icons on it not other programs and other. Its for an gaming place. Please help me.
I need anny help and suggestions.
Thanks
|
|
|
|
|
Maybe this CP article and its references can help (link[^])?
Best,
Jun
|
|
|
|
|
Thanks Jun... that will help me i allredy did my own taskmanager and a firewall that terminate all windows forms that are not mine in secconds...
|
|
|
|
|
Hii Friends,
Can we change the color of a particular row in the datagrid according to the conditions we code.
For e.g. if suppose in the datagrid, values which is retrieved from one database table is matching the values of another table the color of the particular row should change to blue or red or any color.
Is it possible.
Waiting for reply..
Bye..
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
This good posting by Frank Kerrigan will probably point you in the right direction. http://www.codeproject.com/aspnet/PrettyDatagrids.asp.
Good luck,
Tim Robertson
Dallas, Georgia
|
|
|
|
|
I want to read data directly into my visual basic application, how can i do it and what resources are required.
I am a student
|
|
|
|
|
First, you need a barcode scanner. How you write your code depends entirely on how that scanner works, so dig out the documentation on the scanner.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Help please.. Can anyone there resolve this?
-Sample Code-
System.Net
...
'let's assume there are other codes here
dim Addr as IPAddress
With DNS.GetHostByName(<compname>)
Addr = System.Net.IPAddress(.AddressList(0).Address)
End With
...
That should have been the way to get the IP Addresses, but in VBNET 2003
the line: "(.AddressList(0).Address)" is obsolete.. Anyone knows the new way?? Be grateful for the help..
Thanks in advance..
|
|
|
|
|
Since you got that "obsolete" message, you're using VB.NET 2005. Check out the Dns class and its GetHostAddesses[^] method.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hmm.. but i'm using Visual Studio 2003.. anyways do u know another way? Hope u can help me.. i'm still lookin for another way though.. Thanks
|
|
|
|
|
There's only two methods. The one you posted in your code, which gave you the obsolete message, and the one in the .NET Framework 2.0. The .NET Framework 1.0 and 1.1 both use the same Dns class. It was nearly completely re-written for .NET 2.0.
This[^] is the docs for the 1.0/1.1 version of the Dns class.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
" 'Public Property Address() AS Long' is obsolete: 'IPAddress.Address is address family dependant, use equals method for comparison.' "
That's the whole statement of the error. My framework is 1.1, and it cant be 2.0 coz im not using VS2005.. but can i use Framework 2.0 with VS2003?
i haven't found another way..and how can i set the client to look for any server running in any of the pc in a network. Like if i run a Server or the listener on PC4, the client is on PC1, without specifying the IPAddress where the Server file is running.. if i transfer the server to PC8, the client can still detect it. Something like that.
I'm actually new on using System.Net and im just lookin on examples available in the web.
I have tried the basics of Server-Client, the problem is the one i stated above. and the client issue.. thanks
|
|
|
|
|
OK. So you're using 2003. No, you can't use .NET 2.0 with VS.NET 2003. It will only work with VS.NET 2005.
Remove the .Address part of the line. You don't need it unless you want the IP address returned as a 32-bit number. This isn't supported in .NET 2.0, so don't use it.
This code works just fine:
Dim hostInfo As IPHostEntry = Dns.GetHostByName("www.yahoo.com")
Dim address As IPAddress() = hostInfo.AddressList
Dim al As String() = hostInfo.Aliases
Debug.WriteLine("Host name : " + hostInfo.HostName)
Debug.WriteLine(ControlChars.Cr + "Aliases : ")
Dim index As Integer
For index = 0 To al.Length - 1
Debug.WriteLine(al(index))
Next index
Debug.WriteLine(ControlChars.Cr + "IP address list : ")
For index = 0 To address.Length - 1
Debug.WriteLine(address(index))
Next index
and was taken directly out of the docs for Dns.GetHostByName in the .NET 1.0/1.1 docs.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello,
I create an application VB.net 2003 with sql server 2000 and I created the exe file but it didn't work in another computer who's not contain the VB.net 2003 what I suppose install the minimum thing to the execute file work properly
thanks for you help
dadax
|
|
|
|
|
You said the other PC does not have VB.NET 2003? It might not have the .NET Framework.. so you'll have to install "dotnetfx.exe". It can be downloaded at microsoft website.. search for it..
www.microsoft.com
And if you have a database with SQL server.. you will have to setup a SQL server on that PC.. a client i suppose..
goodluck
|
|
|
|
|
<br />
Private Sub _SplitterMoved(ByVal sAs Object, _<br />
ByVal e As System.Windows.Forms.SplitterEventArgs) _<br />
Handles SplitContainer1.SplitterMoved<br />
<br />
For i As Integer = 0 To Me.TabControl1.TabPages.Count - 1<br />
Me.TabControl1.TabPages(i).Refresh()<br />
Next<br />
<br />
End Sub<br />
Is there a better way to fix the tabpages not filling the tabcontrol's area when you move the splitter?
|
|
|
|
|
Hi,Bhagyesh Here,
I was stucked to get Alternate Color shades in my Datagrid,can anyone suggest a precious help for this?
Bhagyesh
Bhagyesh S.Kale
|
|
|
|
|
i have developed an application in vb.net & i want to make my application as start-up i.e when the system will be on,the application will automatically run by itself.no need to double click on the desktop icon.
any suggestions in this regard will be appreciated
i m pradip kishore from india,working in vb.net & asp.net
|
|
|
|
|
When your creating the Install write a shortcut to the .exe into the start-up folder.
In VS 2005:
In the File System >
Highlight the File System on Target Machine >
Right Click > Add Special Folder > User's Start-up Folder then Enter
This will allow you create a shortcut to User's Startup Folder.
|
|
|
|
|
hi
thanks for your valuable suggestion.
can i adopt the same procedure to implement the said facility in a set up file so that whenever i load the setup in the target machine,it will ask for a provision that where want to install(like start-up folder,program files,etc..) & accordingly it will got installed in the target machine
any suggestion will be deeply appreciated
i m pradip kishore from india,working in vb.net & asp.net
|
|
|
|
|
I have an application with several objects which I use to store the data that the user entered. Just like any other application (Word, Excel, etc) I need to save the data entered by the user on the disk, and later if the user wants, he/she must be able to retrieve the data and continue working with the application. (Basically, an open&save functionality)
Not all objects that I am working with are serializable, because I use a lot of collections in my classes, so I gave up on the idea to save them as xml (serialized objects).
My question would be, how do you suggest me to save the data of my application and how to retrieve it later? Which is best file class or file format to be used in this case? I would rather save in a binary format than in a text format, so people can't see and change directly the data.
Thank you all
|
|
|
|