G_Waddell 131 Posting Whiz in Training

Hi,

For no1, maybe try making the form something tiny e.g 1 px in height. Another option is to have a parent form with a menu item that opens a child form underneath with MDI but it could be tricky getting the positioning correct.

For no2 I think you'll be looking at a large form with containers like the panel class. Have a look on Google at the Panel, Groupbox and SplitContainer classes particularly SplitContainer...

For Mdi Child and parent forms: http://www.startvbdotnet.com/forms/mdi.aspx

For SplitContainer: http://msdn.microsoft.com/en-us/library/system.windows.forms.splitcontainer.aspx

For Panels: http://msdn.microsoft.com/en-us/library/system.windows.forms.panel.aspx

G_Waddell 131 Posting Whiz in Training

Hi

You are probably going to have to you the MDI properties to assign one form as the parent and the other as the child:

On your main form load event:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  dim Assessor as Boolean

   Me.IsMdiContainer = True
   ..... 
   If Assessor = true then  
     dim MyForm as New AssessorForm  
     MyForm.MdiParent = Me
     MyForm.show 
   Else 
      ... 
   End if

This should open your assessor form as a child of your main parent form.

G_Waddell 131 Posting Whiz in Training

Hi,

As far as I'm aware, you can not have different formats inside the one label.. looks like you will need to use something else.

G_Waddell 131 Posting Whiz in Training

Hi,

Is it each time your project is run you want a counter to display the number of times it has been run?

G_Waddell 131 Posting Whiz in Training

Hi,
Interesting, you could try this but I'm not guarenteeing it will work:

On form load size height to zero:

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  me.height = 0
end sub

This will hopefully leave the menu bar of the form still visible. next use a mouse enter event to resize the form:

Private Sub Form_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
        Me.Height = 500
    End Sub

As I said Im just guessing at this...

Sorry, I'm not sure what you mean in point two.

G_Waddell 131 Posting Whiz in Training

Hi
But once you've found the target line, then put a second loop in your code to read in the next five.

Dim sr As New System.IO.StreamReader("MyFile")
        Dim i As Integer
        Dim Line As String
        While sr.EndOfStream = False
            Line = sr.ReadLine
            If InStr(Line, "Juice") <> 0 Then
                'do what ever with the line
                For i = 0 To 4
                    Line = sr.ReadLine
                    'print
                Next
            End If
        End While
G_Waddell 131 Posting Whiz in Training

Hi
At it's simplest you just do this:

MyDatagridView.Datasource = MyDataTable 
MyDatagrigView.refresh

You need to get it to refresh to show the changes

Try looking up datagridView class in Google for more details on the properties and some examples of using it.

G_Waddell 131 Posting Whiz in Training

Hi,

If it it still does not work, a good tip when working in Access is to use the QBE to generate the SQL for your query, that way you know the syntax is correct for Access.

G_Waddell 131 Posting Whiz in Training

Glad to be of help, remember to mark the problem as solved...

G_Waddell 131 Posting Whiz in Training

Hi,

Sure read through the file, for each line use the instr function to see if the word exists in that line.

G_Waddell 131 Posting Whiz in Training

Hi,

I now this thread is like intially two years old but I keep seeing people trying to connection to the SQL express instance using ServerName.

SQLExpress always installs its instance as ServerName\SQLEXPRESS

N.B. You can have as may instances of SQL running on the same machine as you wish but only one can be the default ServerName instance the rest will all be ServerName \InstanceName

This is actually handy if you want to put two diffeerent version of SQL on the same machine e.g. Servername\SQL2000 ServerName\SQL2005 or seperate differnet apps on to different instances for security purposes

There rant over I feel better now...

G_Waddell 131 Posting Whiz in Training

Hi
Is it a particular word within a sentence? or just a label?

Label1.Font = New Font(Label1.Font, FontStyle.Underline)

You define a new font based on the old one i.e.

New Font(Label1.Font, FontStyle.Underline)

In otherwords the new font is based on the existing value but with underline

G_Waddell 131 Posting Whiz in Training

Hi,
Basic programming 101

dim i as integer =0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
        Label1.Text = i+1
End Sub
G_Waddell 131 Posting Whiz in Training

Hi,

Your connection string looks ok to me, try checking it here:http://www.connectionStrings.com

The only other thing I can think of is the database.

Is it definately a local SQL express database and is SQL running (check under services)?

What user does your app run under? and does this user have the correct permissions on the database? Instead of using the trusted connection, if you specify the user does that work?

G_Waddell 131 Posting Whiz in Training

OK thats easy enough you do your login, check the user, flag the role they have and if it is an assessor open the form.

dim Assessor as Boolean

.....

If Assessor = true then
  dim Myform as New AssessorForm
  MyForm.show 
Else ...

End if
G_Waddell 131 Posting Whiz in Training

if you are trying to insert a record into the database then try this:

Dim con_str As String = "Data Source=.\SQLEXPRESS;Initial Catalog=data;Integrated Security=True"
Dim cmd As New SqlCommand()        
Dim con As New SqlConnection()
con.ConnectionString =con_str

cmd.CommandText = "INSERT into reg(name,uname,pass,year,branch,scholar,email,add) values (@a,@b,@c,@d,@e,@f,@g,@h)"
cmd.Connection = con        
cmd.Parameters.Add("@a", t1.Text)        
cmd.Parameters.Add("@b", t2.Text)
cmd.Parameters.Add("@c", t3.Text)
cmd.Parameters.Add("@d", t4.Text)        
cmd.Parameters.Add("@e", t5.Text)        
cmd.Parameters.Add("@f", t6.Text)        
cmd.Parameters.Add("@g", t7.Text)        
cmd.Parameters.Add("@h", rt.Text)

if con.State = ConnectionState.Closed then
  con.open()
end if
cmd.Execute()
if con.State = ConnectionState.Open then con.Close

No need for dataset etc if you don't want to see the data....

G_Waddell 131 Posting Whiz in Training

Hi

Are you getting the same error?

Anyway I've just noticed that you are using an Insert Query to try and fill a dataset table - this wont work

Inserts do exactly that, they insert data and they do not return recordsets. You need to use a SELECT statement.

G_Waddell 131 Posting Whiz in Training

Hi,

I'm sorry but I'm not 100% sure what you are trying to do.

Are you wanting to pick a bill number then see all items on the bill?

G_Waddell 131 Posting Whiz in Training

Using system.io just do this:

File.copy(Source, Destination, Overwrite)

Using FileSystemObject this:

fso.CopyFile(Source, Destination, Overwrite)

* Overwrite is an optional boolean, I think by default this is set to False. Anyway True if you want to overwrite an existing file, False if not.

Remember you will need to have at least read access on your source and Write access on the destination directory.

You'll need to specify remote folders as UNC paths too.

G_Waddell 131 Posting Whiz in Training

Hi,

Why use the Access DB? you can link directly to the Excel document as if it was a database table.

Try looking at the Data Files section of http://www.connectionstrings.com for the excel version you are using.

Also you can google ADO.net and Excel or VB.Net and Excel and get loads of examples.

G_Waddell 131 Posting Whiz in Training

Hi

Try inserting these lines:
Before you execute the cmd

If con.State = ConnectionState.Closed Then
  con.open
end if

at the end sub

If con.State = ConnectionState.Open Then
  con.Close
end if
G_Waddell 131 Posting Whiz in Training

Hi,

I'm guessing the file is a csv (comma delimited file) or some other delimited

1 Read in each line of the file to a string
2 Use split on this string to generate an array of substrings (or columns)
3 Print out the necessary Columns from that array - remember VB array index starts at zero..

G_Waddell 131 Posting Whiz in Training

Err.. you've posted to the Vb.net forum not C++

G_Waddell 131 Posting Whiz in Training

hi,

Try this link it should show you the ADO.net connectionstring to Oracle.
http://www.connectionstrings.com

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

hi,

see my reply to your other post....

G_Waddell 131 Posting Whiz in Training

Hi
Is this for the login?
What I do is on the load event of the main form I open the Login form as a dialog:

sub Form1_Load()

dim frmLogin as new LoginForm 'what ever you have called your login form..

frmLogin.ShowDialog

if you've already got the login form handling the user validation, then when it fails, get it to close itself and the app:
http://www.vbforums.com/archive/index.php/t-255285.html

Remember to set your projects starting form to the main form...

G_Waddell 131 Posting Whiz in Training

Hi
Do you have access to a Database? If so store the login records with a timestamp and when the user logs out retrieve this record and get the time difference between the stamp and current time.

If not store your logins in another file and parse it from to get the last login for the user.

G_Waddell 131 Posting Whiz in Training

Hi
Normally scrollable objects have the following properties:

AutoScroll -automatically show scrollbars (True /False)
HScroll - Horizontal Scrollbar (True/False)
VScroll - Vertical Scrollbar (True/False)

e.g. Switch on a horizontal scroll bar:

MyObject.HScroll = True

I'm just not sure if the picture box supports scroll bars I assume it will though.
This may help:
http://msdn.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.hscroll.aspx

G_Waddell 131 Posting Whiz in Training

Hi
Here is the offical ADO.NET (What VB.NET generally uses to connect to datasources) page:
http://msdn.microsoft.com/en-us/library/h43ks021(VS.71).aspx
Here is a site on generating connection string to databases including Access:
http://www.connectionstrings.com

You may also what to try "googling" "DataSets VB.NET", "DataAdapter VB.Net" and "DataReader VB.NET" etc.

G_Waddell 131 Posting Whiz in Training

Hi,

I'd do a double check here if I were you:
http://www.connectionstrings.com
It lists out loads of ways of connecting to different datasources...

G_Waddell 131 Posting Whiz in Training

Hi
Go into Visual studio, select make new project and save.

You have made a new project - it doesn't do anything but it is a new project...

The only place success come before work is in a dictionary.


*This advice is programming language independent

G_Waddell 131 Posting Whiz in Training

Hi
I think I see what your issue is if your text is over a certain value in length you wish to put in a line break but of course not in the middle of a word!
Try something like this:

Sub InsertLineBreaks(ByRef MyInput As String, ByRef MaxLength As Integer, ByRef oWrite As IO.StringWriter)
        Dim MyOutput, sChar As String
        Dim i, x As Integer

        If Len(MyInput) > MaxLength Then
            i = MaxLength
            x = 0
            Do While x < MyInput.Length
                'get inital char at maxlength
                sChar = MyInput.Chars(i)
                Do Until sChar = " "
                    'move back until we hit a space
                    sChar = MyInput.Chars(i)
                    i = i - 1
                Loop
                'output = start of string to the space we've found
                MyOutput = MyInput.Substring(x, i - x)
                oWrite.WriteLine(MyOutput)
                'move start to next string
                x = i + 1
                i = x + MaxLength 'move end so we have max length and repeat proccess
                If i > MyInput.Length Then
                    'i is outside of string length so rest of text will fit.
                    MyOutput = MyInput.Substring(x)
                    oWrite.WriteLine(MyOutput)
                    Exit Do
                End If
            Loop
        Else
            oWrite.WriteLine(MyInput)
        End If
    End Sub
G_Waddell 131 Posting Whiz in Training

Hi,

This link will point you in the right direction using the built in ASP.Net login class.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.aspx

G_Waddell 131 Posting Whiz in Training

Hi

These sites will show you how to use SQL server and Stored Procedures:
http://www.microsoft.com/sqlserver
http://www.functionx.com/sqlserver/

This Site will show you how to connect:
http://www.connectionstrings.com

To put values in to textboxes it is the same as if you had created the SQL query on the fly:

Dim mCommand As SqlCommand = New SqlCommand
 with mCommand
    .CommandText = "MyProcedureName" 'instead of "SELECT * From MyTable etc.
    .CommandType = CommandType.StoredProcedure 'Instead of Text
    'if I want to pass data in use parameters
    .Parameters.AddWithValue("@MyParam", Value)
 end with
 textbox1.text = mCommand.ExecuteScalar() 'assuming a scalar value is returned
kvprajapati commented: Helpful. +10
G_Waddell 131 Posting Whiz in Training

Hi,

I wasn't sure if you where looping through collections or not, in which case I'd always rather type dr("") than myDt.Rows(i).Item("") 14 times.

Also I wasn't sure what you were storing in the database so I did the Cbool part.

Glad I could help

G_Waddell 131 Posting Whiz in Training

Hi,

There are a lot of in build common functions too many to go into on a single post e.g. there are String functions like Split, lCase, Ucase, there are Maths functions like Sqrt, Log, Sin, conversion functions like CStr, CInt, CBool and many more.

Best thing you can do is get some good VB.net books or go to a site like this:
http://www.startvbdotnet.com/language/default.aspx

Or if youre stuck google it e.g. how do I convert to a string in VB.net? (answer Cstr)

G_Waddell 131 Posting Whiz in Training

Hi,
First of all, it looks to me like youi are not passing in the database values but strings e.g. "[Line 1]"

Second, what are the values that you are storing in the database? As far as I'm aware CheckState is looking for three possible values:

Checked - displays a checkmark
Unchecked - Empty (unchecked)
Indeterminate - displays a check and box is shaded

Personally I'd use the Checked property of checkbox instead as it can only be true or false and have each of the values stored in the database as bits or True or False strings e.g.

Dim dr as datarow

If (myDT.Rows.Count > 0) Then  
	dr = myDT.rows(0)	
        line1check.Checked = CBool(dr("[Line 1]"))                    
	line2check.Checked = CBool(dr("[Line 2]"))                    
	line3check.Checked = CBool(dr("[Line 3]"))                    
	line4check.Checked = CBool(dr("[Line 4]"))                    
	line5check.Checked = CBool(dr("[Line 5]"))                    
	line6check.Checked = CBool(dr("[Line 6]"))                    
	line7check.Checked = CBool(dr("[Line 7]"))                    
	line8check.Checked = CBool(dr("[Line 8]"))                    
	line9check.Checked = CBool(dr("[Line 9]"))                    
	line10check.Checked = CBool(dr("[Line 10]"))                    
	line11check.Checked = CBool(dr("[Line 11]"))                    
	utilitiescheck.Checked = CBool(dr("[Utilities]"))                    
	misccheck.Checked = CBool(dr("[Miscellaneous]"))                    
	smokehousecheck.Checked = CBool(dr("[Smoke House]"))                
Else
....
G_Waddell 131 Posting Whiz in Training

Hi,
You should parse through the forms control collection or alternatively if you put them in another container through that.

I'm sorry I was talking about findcontrol, I was just giving you a rough idea off the top of my head, I'll not bother next time.

G_Waddell 131 Posting Whiz in Training

Hi,

What I would do is before your are going to Insert your new city record check for matching records first, if it is clear insert, if not then query the user:

strSQL="SELECT COUNT(*) FROM CITY_MASTER WHERE LOWER(CITY_NAME) = '" &lcase(MyCity) &"'"
.....
If CityCount > 0 then
  msgbox ("Entry already exists for " &MyCity &".")
Else

 strSQL ="INSERT INTO...."

End if
G_Waddell 131 Posting Whiz in Training

Hi
So youve created a load of new checkboxes on the fly and then you want to go through each one and check if it has been checked?

To see if a checkbox is checked in VB.net (and VB too) you need to do something like this:

IF MyCheckBox.Checked Then
  'i.e MyCheckBox.Checked = true
Else
  'Not checked i.e. MyCheckBox.Checked =False
End If

To parse through the checkboxes you are going to have to grab their parent object (e.g. Form or Groupbox etc) and use something like Findcontrol to find each one:

dim sCheckBox as String
dim iCheckBox as Checkbox
dim MyState as Boolean
for i = 1 to 9
 sCheckBox = "checkbox" &i
 iCheckbox = Form.FindControl(sCheckBox)
 if iCheckbox isnot nothing then
    MyState = iCheckbox.Checked
 end if  
next
G_Waddell 131 Posting Whiz in Training

Hi

You'll need to be more specific, it really depends on the program you are communicating with and other factors.

For example, an ASP.NET website on a webserver will usually be using ADO.NET to communicate with a database program on another server. which may in turn be used by an application on a network to provide the same data for some other purpose. There are no files being transfered just data.

G_Waddell 131 Posting Whiz in Training

Hi

What exactly is Login? If that is the name of your form then the line

Login.Close()

Is probably why your form closes.

G_Waddell 131 Posting Whiz in Training

hi
You're getting close..

You have to loop through the values:

dim i as integer
dim DT as datatable
dim DR as Datarow 

'I'm just using DT and DR as I hate having to type out dataset.tables.rows...

DT = ds.Tables("Table1")
'VB uses a zero based index and Count is an actual count therefore we start a zero and end at count-1
for i =0 to DT.Rows.count -1
  DR = DT.Rows(i)
  xPartNumberComboBox.items.add(DR.item(0))
  xPartNameComboBox.items.add(DR.item(1))
next

I suggest you look up using loops in VB.NET

G_Waddell 131 Posting Whiz in Training

Hi
I've more experience with Microsoft SQL server but to me it looks like you are finding the database but don't have the rights to access.

Try pointing the server entry to somewhere that can't / doesn't exist do you get a different message? If so, that means you were getting to the DB it's just not letting you in...

G_Waddell 131 Posting Whiz in Training

Hi
You want all the Rows from the database table returned not just Row 0?

(that was a pretty big hint BTW)

G_Waddell 131 Posting Whiz in Training

Hi
I want a red sports car, a million dollar home and my own airplane.

Seriously are you expecting someone to do all the hard work so you can hand it in for what ever exam / practical you are doing?

The only place success comes before work is in the dictionary.

Try and build what you want then when you run into difficulty ask for help and don't expect someone to spoon feed you the answer.

kvprajapati commented: Words!!! +10
G_Waddell 131 Posting Whiz in Training

Hmm...
Just thought the tables may not have names, just return the count

msgbox (dataset.Tables.count)
G_Waddell 131 Posting Whiz in Training

hi,

I'd really need to see some sample code... A dataset can hold more than one table so it could possibly be that the individual record sets are being stored as datatables inside the dataset
try:

dim iTable as integer
dim strMessage as String
for iTable = 0 to Dataset.tables.count -1
   strMessage &= dataset.Tables(itable).Name
next
msgbox (strMesssage)
G_Waddell 131 Posting Whiz in Training

Hi

Create a new form, put a textbox on it. Create a button with the text value 0 onthe onclick event add a zero to the text of the textbox repeat for numbers 1-9.
add a button for each function you wish to carry out and use the onclick event to fire it off