|
It should be from blue to red gradient color...
the backcolors of these rows return green gradient...
please help me revise the code...
thanks...
Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.DataBound
Dim red As Integer = &HFF0000
Dim blue As Integer = &HFF
Dim green As Integer = &HFF00
Dim noRows As Integer
Dim incDiff As Integer
Dim currentColor As Integer
noRows = GridView1.Rows.Count
incDiff = (red / green) / noRows
currentColor = green
For x As Integer = 0 To noRows - 1
GridView1.Rows(x).BackColor = Color.FromArgb(currentColor)
currentColor += incDiff
Next
End Sub
|
|
|
|
|
im' not really that good with VB.net but i dont see anything mentioning the color blue in that code. Maybe someone else knows what it is, but im not sure if that's it.
-Think not of the problem But of the solution!
-Mind what people do, not what they say, for deeds will betray an lie.
-The only sovereign you can allow to rule you is reason.
-Contradictions don't exist, in whole or in part.
|
|
|
|
|
Why are you asking the same question again? Follow up in the thread that is already active instead.
---
b { font-weight: normal; }
|
|
|
|
|
I used WebBrowser Contorl in my application when i run it the application run webbrowser to display page correctly, unfortunately the page that contain javascript, ... it alert message as normal.
How can i chnge title bar of alert message?
................
|
|
|
|
|
Hi.... guys
I need a favor from you who have an experience in Overtime calculation, I want to build a program which could counting overtime for each employee in my company,
I need to know how to count the overtime which is over than two days as well , I mean if the overtime is start from 17:00 until 04:00 following days.
Thank you fro your attetnion and your support in advance.
Best regards
ICE
|
|
|
|
|
Include the date in the data, then you can calculate the time difference without problem.
The difference between 2006-06-01 17:00 and 2006-06-02 04:00 is 11 hours or 660 minutes:
Dim start As DateTime = New DateTime(2006,6,1,17,0)
Dim finish As DateTime = New DateTime(2006,6,2,4,0)
Dim minutes As Integer = finish.Subtract(start).TotalMinutes
---
b { font-weight: normal; }
|
|
|
|
|
Hi Guffa
Thank a lot for your advise and I have tried to write and run those command into a small program but it doesn't working well. I made Three Text box ( textbox1,textbox2 and textbox3), and here is the structure of my program
dim start as datetime
dim finish as datetime
dim minutes as integer
start=textbox1.text
finish =textbox2.text
minutes=finish.subtract(start).totalminutes
textbox3.text=minutes
I tried to run this program but it wont be runing propherly it just has 0 as the result came up on the textbox3
I am affraid that I have made a mistake, but I have no idea how to write the right logic program for this case. If you don't mind please let me get your next advise
Thank you
Best regards
ICE
|
|
|
|
|
Despite the total disregard for data types, it looks like the code should work. What did you enter in the textboxes?
---
b { font-weight: normal; }
|
|
|
|
|
Hi every body,
I'm workin on a vb.net 2003 ,and on an Access db.
I've the table :"CarParts" has these columns(PartNo,PartName,Price)
and I've a question I hope someone could help me to solve it.
I've a checkedlistbox,and I binded it to (PartName)column .
when I check an item I want it's name to be added to a textbox to save in a specivic column,and it's price to be added in another txtbox just to get the sum of all the checked items.then I would be able to save the whole selected items written in this textbox to save them in another column and I will be abel to save the sum of all the selected items in another column .
I did it by usuing the checkbox tool and it succeeded,according to the next code where i binded the Price column to one Label just to help me doing the sum,this label work even if i updated the prices:
if checkbox1.checked the <br />
bmb.position=0 <br />
sum += Val(Label 1 .text) <br />
textbox1.text & = " the 1st car part name" <br />
end if <br />
if checkbox2.checked the <br />
bmb.position=1<br />
sum += Val(Label 1 .text) <br />
textbox1.text & = " the 2nd car part name" <br />
end if <br />
.<br />
.<br />
.<br />
etc..<br />
Here is my CheckedListBox code it's just loading the (PartName)column data ,what Should I add to make it do the checklistbox job, pleeeeease help me:
Code:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click <br />
Dim strcon As String <br />
Try <br />
strcon = " provider=microsoft.jet.oledb.4.0;datasource=Cars.mdb " Dim con As New OleDbConnection(strcon) con.Open() <br />
Dim adapter As New OleDbDataAdapter("select * from CarParts", con) <br />
Dim cn As OleDbConnection = New OleDbConnection Dim dset1 As New DataSet <br />
Dim dt As New DataTableadapter.Fill(dt) CheckedListBox1.DataSource = dt CheckedListBox1.DisplayMember = "PartName" <br />
Catch ex As Exception <br />
MessageBox.Show(ex.Message) <br />
<br />
End Try <br />
End Sub
-- modified at 2:28 Friday 2nd June, 2006
|
|
|
|
|
I was given this code when I asked if anyone knew how to check if a user of my Visual Basic program is connected to the internet so that I can handle "Page cannot be displayed" errors, however I am a newbe to visual basic and this code does not make any sence to me, nor do I know how to use it...
Can someone explain what steps I would follow to impliment this code? For example, where do I put this code? How do I call the function?
Thanks.
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef _
lpSFlags As Long, ByVal dwReserved As Long) As Long
Const INTERNET_CONNECTION_MODEM = 1
Const INTERNET_CONNECTION_LAN = 2
Const INTERNET_CONNECTION_PROXY = 4
Const INTERNET_CONNECTION_MODEM_BUSY = 8
' return True if there is an active Internect connection
'
' optionally returns the connection mode through
' its argument (see INTERNET_CONNECTION_* constants)
' 1=modem, 2=Lan, 4=proxy
' 8=modem busy with a non-internet connection
Function IsConnectedToInternet(Optional connectMode As Integer) As Boolean
Dim flags As Long
' this ASPI function does it all
IsConnectedToInternet = InternetGetConnectedState(flags, 0)
' return the flag through the optional argument
connectMode = flags
End Function
|
|
|
|
|
Hi
What type of project are you running - exe, dll etc.
Normally, you would put it in a class/module and call the function. For a better reply, you need to give more info.
Regards
Shreekar Joshi
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
I am creating a .exe file in visual basic. I have a button and a web browser (the standard one that you add from the toolbox) setup to load a webpage in a the web browser when the button is clicked. I am trying to stop the "Page cannot be displayed" page from loading if the user of my program is not connected to the internet, so I want to be able to check if the user is online that way I can route them to an offline version if necessary.
My code looks like this:
Public Class Form1
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate("http://www.google.com")
End Sub
End Class
Thanks again for the help!
|
|
|
|
|
Hi
In the button click procedure, just call the CheckInternetConnection function. If it is true, then navigate to the internet site, otherwise, show the user offline version.
However, you will need to put the declaration and definition of the function in a public module and make the function public as well.
HTH
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
I used to have an event listener (Back in my AOL PROGZ days... that allowed you find and address an object via VB to manipulate it or make a simple listener.
I have a program that I use at work that is written in poor VB. There is a button in this program that changes captions, and I would like to create a program that makes a sound when the button's caption changes. This is why I need to find the external event listener that I once had...
If anyone can help (or pose an alternate solution) I would really appreciate it. Thanks!
- Gabe
-- modified at 1:59 Friday 2nd June, 2006
|
|
|
|
|
Hi guys,
Here's what i want to do w/ the module.
I want to declare my connection properties in the module so i can just call
it w/in my forms whenever i have to use it.
here's whats inside my module
Imports System.Data.OleDb
Module mod_con
Public Sub establish_con()
Dim con_db_ssr As OleDbConnection
con_db_ssr = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\i1984\Automation\db_ssr.mdb;")
End Sub
End Module
am i doin it ryt? then i want to call it...
tnx.
-::maximus::-
-- modified at 23:15 Thursday 1st June, 2006
|
|
|
|
|
Hi
SO what is the question - or, what is the error? You seem to be doing it right if all you want is to expose the Connection open code as a function. If you want to do something else, please post the error/question/intention.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
Hi, I saw this project:
http://www.thecodeproject.com/csharp/OazSwitchNetConfig.asp?df=100&forumid=43385&select=1513418&msg=1513418[^]
and tried to make it on VB. NET, Im really new with this, and I cant contionue because I cant convert the system.string[] into a normal string, I have everything equal, and when I make this:
For Each mgr As ManagementObject In management.GetInstances()
If mgr.Item("IPEnabled") Then
txtDireccionIP = mgr.Item("IPAddress").ToString()
Exit For
End If
txtDireccionIP variable just show system.string[], why? because is an array?, I tried split it, get elements with a for each but nothing, what Im missing?
Thanks everyone...
Mauricio Rodriguez
newbie
|
|
|
|
|
I have a progam created and all ready to install. I used the VB.NET setup project for my deployment in Visual Studio 2005. My setup project uses prerequisits of the .NET Framework 2.0, MDAC, and a Windows Installer. Running the setup works fine, except on a computer where the user logged in does not have admin rights. When this occurs the setup fails and displays a very cryptic error. Does anyone know how I can somehow check if the user installing my program has admin rights, so that I can display a nice professional message notifying them that they need admin rights instead?
|
|
|
|
|
Kschuler wrote: When this occurs the setup fails and displays a very cryptic error
What do you mean by cryptic error. As far as I know, windows display a message box "Access denie...". I think this error is manage by windows because your application is running in windows.
|
|
|
|
|
Function IsMember(sUser,sGroup)<br />
' sUser must be a complete LDAP string:<br />
' cn=DonJ,ou=West,dc=Company,dc=com<br />
<br />
On Error Resume Next<br />
Const PROPERTY_NOT_FOUND = &h8000500d<br />
<br />
Set oUser = GetObject(sUser)<br />
If Not IsObject(oUser) Then<br />
IsMember = False<br />
Exit Function<br />
End If<br />
<br />
arrMemberOf = oUser.GetEx("memberOf")<br />
If Err.number = PROPERTY_NOT_FOUND Then<br />
IsMember = False<br />
Exit Function<br />
Else<br />
For Each Group in arrMemberOf<br />
If Group = sGroup Then<br />
IsMember = True<br />
Exit Function<br />
End If<br />
Next<br />
End If<br />
<br />
IsMember = False<br />
End Function
|
|
|
|
|
Thanks for the code, but where would I be able to put this so it would run before an install? Keeping in mind that the user will probably not have the .Net 2.0 framework installed yet, which Visual Studio 2005 requires (So I can't just put it in a DLL/exe and run it before the install)
And when I say that the error message is crypic...the first message that is displayed says something along the lines of "The installation failed, program requirements were not met." and then the user has to hit the "details" button to see more information about the error, and somewhere in there is does say something about not having authority. The issue is that I program for a demographic of users who are not computer savy, and they will have a lot of trouble if we can't find a way to make this issue more clear.
|
|
|
|
|
Kschuler wrote: Thanks for the code, but where would I be able to put this so it would run before an install? Keeping in mind that the user will probably not have the .Net 2.0 framework installed yet, which Visual Studio 2005 requires (So I can't just put it in a DLL/exe and run it before the install)
I never build any program in vs.net 2005. I just used to work in vb.net 2003. Based on your information, I would like to do as the following instruction:
1. Download and install DotNet Bootstraper[^].
2. Build your application based on this article[^].
3. Check the content of the debug folder after build an install from step 2.
4. Create the script file to check for the group membership of the user.
This is the syntax of the function
IsMember(sUser,sGroup)
Use the syntax as this below guideline:
If IsMember("cn=[UserName],ou=[OUName],dc=[CompanyName]","[GroupName]") Then<br />
' The user is a member - do something here (start to execute the setup file)<br />
Else<br />
' The user is not a member - do something here (prompt user to exit an installation process).<br />
End If
Use this instruction plus the the code that i gave you in the previous post and try to test an application.
5. Create an autorun INF file to point to the script of checking group membership.
6. Burn all relate file to CDROM.
How its work
------------
1. Insert your CDROM to the target machine.
2. The CDROM is autorun and point to run the script file to check the group membership.
3. If the user is a member of an appropriate group to install an application, then the script should point to run the setup file of your application.
4. If the user is not a member of an appropriate group to install an application, then the script would terminate the user from installan application.
Try to do this step and hope this would help you to solve the problem.
|
|
|
|
|
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work.
I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record?
Thank you for any help!
|
|
|
|
|
What kind of an object are you getting the data from? And what version of Visual Studio do you use?
If you are using a DataTable you could use
dtMyTable.Row(0)("PaymentType")
To access the "PaymentType" column in the very first record.
dtMyTable.Row(1)("PaymentType")
To access the second record, and so on.)
If you mean the greatest record, you would have to sort the data first, by which ever column you wish to sort by. You'd have to do the sorting in SQL or by using a DataView control.
Does this help?
|
|
|
|
|
I'm using Visual Studio 2003 and the data is coming from a SQL 2000 table that I am connected to and am pulling data from via a Query Select statement.
|
|
|
|