G_Waddell 131 Posting Whiz in Training

Hi
Not sure what you are looking for?

G_Waddell 131 Posting Whiz in Training

All your divs are floating left... W3 Schools Float It looks to me like you have an outer div Driver, with two inner divs info and drop zone because the inner divs are both left floating they will be both trying to be on the left hand side of the outer div both with a starting point of 1 px relative to their parent Div I'm not sure if the browser would try and Stack the DIVs over each other also I've always specified color by name or Hex code so not sure what colors you are using (Decimal values in an RGB?)

G_Waddell 131 Posting Whiz in Training

What are you searching?
Records in a Database?
Or do you want a search engine like Google?
Or Files in a directory?

G_Waddell 131 Posting Whiz in Training

Or you could use a bit field (True/ False) - but it would have to make sense as it would only return a true (1) or false (0)

OR
If you pass a bit parameter you could do something like this in a strored procedure:

IF(@Male =1) 
BEGIN 
    UPDATE tblStudents Set gender ='Male' WHERE (studentID = @ID) 
END 
ELSE 
BEGIN 
    UPDATE tblStudents Set gender ='Female' WHERE (studentID =@ID)
END
G_Waddell 131 Posting Whiz in Training

Hi
Did you set up the columns beforehand?

hmmm must be returning the index of the row - I thought it would just add it. You could try this instead:

While reader.Read
    MyNewRow = DataGridView1.Rows(0).Clone
    'Do Whatever
    DataGridView1.Rows.Add(MyNewRow)
End while
G_Waddell 131 Posting Whiz in Training

Sounds like you want us to do your homework...

Begginnerdev commented: Exactly what it sounds like.. +5
G_Waddell 131 Posting Whiz in Training

In Your Add Columns routine add ALL the columns you need, those from the database and the extras.

Next in your RunSQL routine, loop through the result set and add new rows to the datagridview as you go:

dim MyNewRow as DatagridViewRow
While reader.Read
 myNewRow = DataGridView1.Rows.Add
    MyNewRow.Cells(0).Value = reader.Item("Patient Account Number").ToString
    'And so on....
    'For Non DB cells just set the value
    myNewRow.Cells(1).Value = MyNonDBValue
    'if you have a Checkbox column in cell 2 then and wish to check it
    MyNewRow.Cells(2).Value = True
End While

You could always go back and populate any of the extra cells if required.

IMPORTANT
You will not be databinding the grid as you are placing extra columns

If for any reason you wish to run these routines on an already populated grid, you should clear the Columns and Rows first or you will append the new columns or rows to the Existing data.

G_Waddell 131 Posting Whiz in Training

Thanks AndreRet!

If they are on a database then you could run a query to check for conflicts before adding.

sSQL = "SELECT COUNT(*) AS NoOfConflicts From MyEvents" & _ 
    "WHERE ((@EventStart <= EndDate) AND (@EventEnd => Startdate)) " & _ 
    "OR ((StartDate <= @EventEnd) AND (EndDate => @EventStart)"

'Ill Assume you have SQL Server
dim cmd as new sqlCommand
dim conn as new sqlConnection(MyConnectionString)
with cmd
.commandType = CommandType.Text
.CommandText = sSQL
.Connection = conn
.Parameters.AddWithValue("EventEnd",EventEndDate)
.Parameters.AddWithValue("EventStart", EventStartDate)
End With
IF Conn.State <> ConnectionState.Open then
    Conn.Open
End If
if cmd.ExecuteScalar() >0 then
'There is a conflict
end if
G_Waddell 131 Posting Whiz in Training

Thanks!!

G_Waddell 131 Posting Whiz in Training

HI All,

I'm writing an application in Visual Basic .NET but the application will use a SQL backend.

If the user runs the application and the backend database is not set up, I want the user to select a SQL Database Instance, supply an administrator user ID (sa) and Password and then the application will connect to the SQL Instance via ADO.NET and Create the Database.

The app will then create a Database user for the application to use (so we don't have users using the Admin account,) and then create the Tables and Stored procedures in the database and grant execute permissions to the user on the stored procedures.

In order to do this I'm passing the necessary Transact SQL statements as a string into a SqlCommand object and executing.

I almost have this all down BUT I have a concern around the creation of stored procedures.

Simple stored procedures like:

CREATE PROCEDURE MySimpleSP 
@ID bigint AS 
SELECT * FROM MyTable WHERE (ID = @ID) 

I can pass in as one line of text and I'm fairly sure it will work. However, I have procedures written using multi steps with transactions like this:

CREATE PROCEDURE MyComplexProcedure
@UserName varchar(255),
@ID Bigint OUTPUT 
AS
DECLARE @TRANS varchar(100), @RecordID bigint

SELECT @TRANS ='INSERT_NEW_USER'

BEGIN TRANSACTION @TRANS

INSERT INTO UsersTable (UserName) VALUES(@UserName)
IF @@ERROR = 0
BEGIN
    SELECT @RecordID = SCOPE_IDENTITY()
    IF @@ERROR =0
    BEGIN
        COMMIT TRANSACTION @TRANS
        SELECT @ID = @RecordID
        RETURN
    END

END
IF @@ERROR <> 0
BEGIN …
G_Waddell 131 Posting Whiz in Training

Can you post your existing HTML - it be easier to figure out what is happening

G_Waddell 131 Posting Whiz in Training

Your Sql string is wrong it looks like a mishmash of a SELECT and an INSERT Statement

If you wish to DELETE Something the Syntax is as follows:

DELETE FROM Table WHERE 'Conditions go here

If you do not specify any conditions, you will wipe the whole table.

G_Waddell 131 Posting Whiz in Training

If you are reacting to user selection of the cell:

If myDataGridView.CurrentCell.value = true then
 'the cell has been checked
end if

If you are reacting to the user selecting a whole row (Selection mode = Row Select)
You only allow one row selection or wish the first selected row and your checkbox is in first cell :

If myDataGridView.SelectedRows(0).Cell(0).Value = True then
    'Checkbox is checked
End if

If you wish to just loop through all the rows and again the checkbox is in the first cell:

for each DataRow as DataViewGridRow in MyDataGridView.Rows
    if DataRow.Cells(0).Value = true then
        'The Cell in this row is selected
    end if

next
G_Waddell 131 Posting Whiz in Training

What information? Where and when do you want to display it?

G_Waddell 131 Posting Whiz in Training

Where are your Events being Stored? are they on a database?

Anyway the logic for comparing the two events to see if there is a clash is something like this:

Sub CompareEvents (byref Event1Start as datetime, byref Event1End as DateTime, byRef Event2Start as Datetime, ByRef Event2End as Datetime)

    IF (Event1Start < = Event2End) AndAlso (Event1End  = > Event2Start) then
        'Overlap Event2 ends after event1 starts and Starts before Event one ends
    ElseIf (Event2Start < = Event1End) AndAlso (Event2End = > Event1Start) Then
        'Overlap Event 1 ends after Event2 starts and starts before Event2 ends
    Else
        'OK
    End if
End sub
AndreRet commented: Made it look so easy. +12
G_Waddell 131 Posting Whiz in Training

Have you tried using Session variables? They will be "Alive" for the length of the session.

G_Waddell 131 Posting Whiz in Training

It looks like you have tried to enter an invalid time format

3.00:00:00 you have a decimal point not a : you mean 3:00:00:00 Or 3:00:00 either way they are the same

G_Waddell 131 Posting Whiz in Training

Hi you will have to set your Resume field type in the Database as a binary type (Image, Binary etc.) Then you will need to open the Word Document as Stream and insert the Binary Stream into the database.

There should be examples of each of these steps out there on the web - to start you off look up the Stream and StreamReader classes

G_Waddell 131 Posting Whiz in Training

ascii Table web site will give you the Ascii key codes for most characters - you can then use the KeyCode example given by bnitishpai above to filter out what you don't want.

For example, this code will block them entering the invalid text altogether.

Private sub Textbox1_OnKeyPress(byVal sender as object, byval e as System.EventArgs) Handles Textbox1.KeyPress
dim AsciiCode as integer  = e.keycode    
If AsciiCode = 32 OrElse AsciiCode = 46 then
    '32 is a space, 46 is a .
    e.Handled = true 'Allow input       
elseif AsciiCode => 65 AndAlso AsciiCode <= 90 then
    '65 = Upper Case A , 90 is Upper case Z
    e.Handled = true 'allow input
else
    e.Handled = False ' block input
end if

Alternatively, you could let them enter lower case but return the upper case character.

G_Waddell 131 Posting Whiz in Training

I stand corrected, although I did say Should Why? because if someone were to write 0<= a <= 100 in then that is a single condition i.e. a is a positive value that is less than or equal to 100.

G_Waddell 131 Posting Whiz in Training

The Proxy server would control access to the router - you can have hardware ones or software ones. I'd suggest that you could create a software based one like Microsoft ISA with a easy interface to allow admin users to carry out basic functionality.

Sorry, I didn't realise that you were a beginner at networking - I've not really done any network stuff at the level you'd need for years, Although I'm sure they're loads of guys out there on this forum who could help - Try under Hardware & Software

G_Waddell 131 Posting Whiz in Training
menuitem.visible = false
G_Waddell 131 Posting Whiz in Training

Hi
There's loads of free SVN stuff out there, I use CollabSVN and a plug in tool they offer AnkhSVN that allows you to manage it from within Visual Studio - you can check in and out items etc. through your solution explorer and it allows for branching as well.

Collab

G_Waddell 131 Posting Whiz in Training

Did you execute the command? e.g.

cmd.ExecuteNonQuery()
G_Waddell 131 Posting Whiz in Training

I think the clause you're looking for is:

If 0<= a <= 100 then

i.e. 0 is less than or equal to "a" which is less than or equal to 100

VB.net should be able to handle this although you may have to use parenthesis:

If (0<= a <=100) then

AND, ANDALSO, OR and ORELSE are used for testing two conditions but "0<=a<=100" is one logical condition

G_Waddell 131 Posting Whiz in Training

You have to add the parameter as an Output Parameter BUT an UPDATE statement will not produce one and neither would an INSERT you'd have to run a select query for it.

What kind of database are you using?

If you are using Micorsoft SQL Server then you do this with a Stored Procedure instead of querying on the fly. i.e. within the Stored Procedure run the INSERT statement then output the SCOPE_IDENTITY() to get the identity field value of the record you just created.

G_Waddell 131 Posting Whiz in Training

True but, if he is using dates through out his app, he can reuse the class...
Actually it was just what popped into my head at the time.

G_Waddell 131 Posting Whiz in Training

I thought you wanted the users to type "Jan"or "January" and the items for January would appear?

If suggestion from TnTinMN works then great, if not, how about giving them combobox to pick the month and pass the month value into Rev Jims query?

You could create a month item class:

Public Class MonthItem
Private Property _MonthName as string
Private Property _MonthValue as Integer

Public ReadOnly Property MonthName As String
 Get
    Return _MonthName
 End Get
End Property

Public Property MonthValue as Integer
    Get 
        Return _MonthValue
    End Get
    Set (ByVal value as Integer)
       If value <= 12 AndAlso value > 0 then
        _MonthValue = value
        _MonthName = MonthName(value,false)
       else
        _MonthValue =0
        _MonthName ="Invalid"
       end if
     End Set
End Property

Public Overrides Function ToString() As String
    Return MonthName
End Function

Public Sub New (ByRef iMonth as Integer)
    me.MonthValue = iMonth
End Sub
End Class

Then on your Form Have a combobox configured as a dropdown list and do something like this:

'populate combo
dim myMonth as MonthItem
for i as integer =1 to 12
    MyMonth = New MonthItem(i)
    MonthCombo.Items.Add(MyMonth)
next

Finally to get the month to put into the statement from Jim:

dim MyMonth as MonthItem

MyMonth = Monthcombo.selectedItem

sql="select * from table1 where datepart('m', mydatefield) =" &myMonth.MonthValue
G_Waddell 131 Posting Whiz in Training

this would work in SQL Server - not sure about ACCESS....

sql ="SELECT *  FROM tblname  WHERE (Datename(month, fldDate) LIKE '%'" & textbox1.Text & "'%')"
G_Waddell 131 Posting Whiz in Training

If the login form had been changed a couple of days ago then it WOULD consistanly occur since the change. i.e. everytime.

Do YOU have full control over the site you are trying to log into? In other words, can you guarentee no one has changed the web site or its login page?

G_Waddell 131 Posting Whiz in Training

Hi,

I haven't actuallly looked at it yet, as I'm still finalising the specs for my project. It was just recommended to me by a colleague. It supports limited time licencing and is free. from what I did look at there seams to be plenty of examples on the web site and user forum including tutorials - I think it should still work with VS 2010 - if you are worried about it, you could set up your project to use .Net 3.5 (it should be under project options)

G_Waddell 131 Posting Whiz in Training

Have you set up the TblNotesTableAdapter with the necessary Access SQL command and connection
etc?

I would run in debug but before you go into the For each Note loop I'd check that PsychologicalStateTrackerDataSet.tblNotes.Rows.Count > 0 i.e. you have data.

Also what have you defined Note as? Looking at the code it should be a datarow but it looks like you have it as a class of some sort.

G_Waddell 131 Posting Whiz in Training

I've never worked with the Windows Music player before so here is a high level view of what I would do.
You will need to store the tracks listing either in a file or database unless you can access directly from the player.

Take a count of the track you have availble and use the random class to randomly pick a track.. something like this:

Private Function RandomTrackPicker(MaxValue as Integer, _
    Optional ByVal MinNumber As Integer = 0) As Integer

      'initialize random number generator
        Dim r As New Random(System.DateTime.Now.Millisecond)

      'if passed incorrect arguments, swap them
        'can also throw exception or return 0

        If MinNumber > MaxNumber Then
            Dim t As Integer = MinNumber
            MinNumber = MaxNumber
            MaxNumber = t
        End If

        Return r.Next(MinNumber, MaxNumber)

    End Function

Then whatever number returns should be a random number of a track to play.

G_Waddell 131 Posting Whiz in Training

The easiest way I can think of is to record each time a user enters a new page that way previous page entry - new page entry = time on page.

The problem is though what if they stay on a single page then leave your site? You also wont know the time they spent on the last page they were in....

You could try ajax but how accurate would you have to be? A partial page load every second yuck!

Your problem is on the server you can only monitor client interactions so if I close a page nothing goes back to the server - only indication would be a session time out...

G_Waddell 131 Posting Whiz in Training

Do you really need it to be all entered in one go?

It would be a lot easier to enter course by course...

I would put the education levels into a dropdown list that the user select and the rest in text boxes that the user fills in.

You would then run a oleldb command with a SQL Insert query to add the details.

G_Waddell 131 Posting Whiz in Training
G_Waddell 131 Posting Whiz in Training

how to make a trial version
Is this a duplicate posting?

G_Waddell 131 Posting Whiz in Training

Hi,

You could try something like:

Private Sub EnableDisableMyControls (Optional ByVal bEnabled As Boolean =TRUE)
    NClose.Enabled = bEnabled
    CloseNote.Enabled = bEnabled
    CloseNoteContext.Enabled = bEnabled
    CloseNoteX.Enabled = bEnabled
End Sub

If tabC.TabCount =1 Then
    EnableDisableMyControls(TRUE)
Else
    EnableDisableMyControls(FALSE)
End if
G_Waddell 131 Posting Whiz in Training

Is it possible that the site has been updated and the login form, associated controls and code behind it have been changed?

G_Waddell 131 Posting Whiz in Training

The code given is looping through the listview Items and seeing if the sub item at index 3 ( which is column 4,) has the text that was entered in the textbox.

G_Waddell 131 Posting Whiz in Training

Hi
I'm going to be trying something similar soon and was told this product was pretty good for implementing licencing including trials and was free too:
Active Lock Software

G_Waddell 131 Posting Whiz in Training
if Control.IsKeyLocked(Keys.CapsLock) OrElse My.Computer.Keyboard.CapsLock then
    'The Caps lock is on....
End if
G_Waddell 131 Posting Whiz in Training

I haven't encountered this on 2010 but I have encountered similar on earlier versions - it used to occur when the version of the .NET Framework you were using had a newer service pack that the one Visual studio was trying to install e.g. 3.5 verses 3.5 sp1. It'd get compounded by other software usually provided by the hardware manufacturer running on the later versions of .NET

G_Waddell 131 Posting Whiz in Training

You want to know when someone pressed caps lock in the rich textbox? Or just when caps lock is on and the rich textbox gets focus?

To see what some pressed while in the rich textbox you should use the KeyDown or KeyPress events of the rich text box and code something like this:

if Control.IsKeyLocked(Keys.CapsLock) Then 
    MessageBox.Show("The Caps Lock key is ON.") 
Else 
    MessageBox.Show("The Caps Lock key is OFF.") 
End If 
G_Waddell 131 Posting Whiz in Training

Hi,
What you are really asking is how to read POP3 emails through .NET.

You would just pass in the Gmail account details to access (you should be able to get this information from Google as people configure Email apps like Outlook to do this all the time.)

I found a thread on this very forum that should help you:
http://www.daniweb.com/software-development/vbnet/threads/407409/vb.net-receiving-emails-using-pop3

G_Waddell 131 Posting Whiz in Training

Sounds good but you have identified the main problem you will encounter that may not make this a practical project for you.

By their very nature, it will not be easy to get into the Router to do this - some have Web based interfaces that you may be able to access but they will be local to the router or computer that is set to administer it and will probably block attempts to push data from the outside and they will never be standard accross the range of manufacturers.

I'm thinking it may be easier to try building your own proxy with a simple interface that would then connect to the router that way you could block user access out of the network before it gets to the router. You could also try things like blocking web access at certain times of the day, blocking certain sites etc. A network traffic monitor to provide statistics on what the users are doing could be good too.

It's sounds like you are interested in this field so you'd probably have a few ideas your self - try to do a project that goes with the type of job you'd like to do when you leave your course.

G_Waddell 131 Posting Whiz in Training

Hi,
When exactly did this start happening? I see you are using an object Bentalls? Could this have been corrupted?

G_Waddell 131 Posting Whiz in Training

Hi All,
Ever tried to make a change to a SQL database table only to get a message telling you it is unable to carry out the change as it would have to drop and recreate the table?

This is one of these things that you encounter once, correct and then forget about. I encountered it today on a new database server I had set up so I thought I'd post the solution here.

Basically Microsoft decided in their wisdom to by default not allow users to carry out changes to tables that would involve the table being droppped then recreated. On one hand, fair enough, saftey first and all that. But on the other, annoying - I know what I'm doing!!!

So how to fix, in SQL Server Management Studio, select the Tools menu then Options... and open the Options dialog.

In the dialog, you should see a Designers option and under this a Table and Database Designers option.

In the Table and Database Designers option, there will be a checked checkbox labelled Prevent saving changes that require table recreation. Uncheck this option and hit the OK button and then forget about it until you create a new database server and curse Microsoft for making you have to go and search for this article again.... :)

G_Waddell 131 Posting Whiz in Training

What selection mode is your datagrid using? If it is rowselect I think you will have use SelectedRows instead of CurrentRow, CurrentRow gets the row of the current selected cell but if you are using the rowselect mode you have not selected a cell but a row and so you will always get a zero.

G_Waddell 131 Posting Whiz in Training

~Not sure what you are looking for? try searching under Msdn site for datetimepicker control for examples.

Or do you want to know in which date format the date is returned in?