G_Waddell 131 Posting Whiz in Training

Hmmm...
You'll need to somehow "capture" the file path you are selecting.

I think you'd find it eaiser to use something like the treeview control in your app to give you an "Explorer" type view that you could then select the file node from.

G_Waddell 131 Posting Whiz in Training

Hi

You need to get your folder selection into a string and then open a folderdialog with the path set to that string.

Where are you selecting / cutting / dragging your folder paths from?

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,
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

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

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

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

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,

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,
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,

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
G_Waddell 131 Posting Whiz in Training

Hi
To Refer to the OpenFileDialog you would use something like this:

dim MyDialog as New OpenFileDialog

You should be able to find out how to use the dialog here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx
To actually open, edit and save the file then you should use System.IO Namespace if you look it up on Google you'll see lots of examples of using it.

G_Waddell 131 Posting Whiz in Training

Hi
You would need to hold your values in a string or some other variable that you can then put into a message box at the end of your loop. e.g.

dim ReOrderItems as String

For increment = 0 To MaxRows - 1

quantity = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Quantity")
reorderlevel = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Re-Order Level")
name = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Model")

If reorderlevel >= quantity Then
MsgBox("Need to re-order" & name)
ReOrderItems = ReOrderItems &name &", "
Else
MsgBox("Stock is OK")
End If

Next
msgbox("The following items need to be restocked:" &vbcrlf  &ReOrderItems)
G_Waddell 131 Posting Whiz in Training

I'm using mysql database..I have forms setup main form has datagrid..you can add to this datagrid and save to datbase with my add form and it works fine. I can delete from the datagrid and it works fine...when I select an account to edit is when I have my issue...form edit brings up the selected account but when I save my changes it doesn't save to the selected account it changes my first account in the database...Help...here is a sample of my code
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' 'Save changes to database and exit
Dim intResponse As String
intResponse = MsgBox("Do you want to SAVE Changes to this record?", vbOKCancel, "Save?")
If intResponse = vbOK Then

PbCustomerDS.customer(0).Address_Line1 = Address_Line1TextBox.Text
PbCustomerDS.customer(0).Location = LocationTextBox.Text
PbCustomerDS.customer(0).Attention = AttentionTextBox.Text
PbCustomerDS.customer(0).City = CityTextBox.Text
PbCustomerDS.customer(0).State = StateTextBox.Text
PbCustomerDS.customer(0).Zip = ZipTextBox.Text
PbCustomerDS.customer(0).Phone = PhoneMaskedTextBox.Text
PbCustomerDS.customer(0).Bill_To = Bill_ToTextBox.Text
PbCustomerDS.customer(0).Attention_2 = Attention_2TextBox.Text
PbCustomerDS.customer(0).B_address = B_addressTextBox.Text
PbCustomerDS.customer(0).B_City = (B_CityTextBox.Text)
PbCustomerDS.customer(0).B_State = B_StateTextBox.Text
PbCustomerDS.customer(0).B_Zip = B_ZipTextBox.Text
PbCustomerDS.customer(0).B_Phone = B_PhoneMaskedTextBox.Text
PbCustomerDS.customer(0).Comments = CommentsTextBox.Text
PbCustomerDS.customer(0).Updated = UpdatedLabel1.Text

Me.Validate()
Me.CustomerBindingSource.DataSource.GetType()
Me.CustomerBindingSource.EndEdit()
Me.CustomerTableAdapter.Update(PbCustomerDS)
Me.TableAdapterManager.UpdateAll(PbCustomerDS)

Me.Close()
End If
If vbCancel Then
Exit Sub
End If

End Sub

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

can someone please help me with my issue?

Well the reason you are getting the first record changing is because you've hardcoded that the routine will change the first record i.e. the zero index record on the data grid.....

Instead of using

PbCustomerDS.Customer(0).

you need to identify the index of the currently selected row and pass it …

G_Waddell 131 Posting Whiz in Training

Hi
I think you are looking for a data item....

e.g.

sub populatecomboboxManually ()
dim MyCombo as New Combobox

'do whatever you need to get your data.....
for i = 1 to 10
'New DataItem(ID (is not displayed) , Value (is displayed))
MyCombo.items.add(New DataItem(i,MyValue))
Next
end sub

sub readvaluefromcombo()
dim myDi as DataItem
dim myID as integer 'can of course be anything you want
dim myValue as String 'as above
myDI = MyCombo.SelectedItem
MyID = DI.ID
MyValue = DI.Value
end sub

As I said you can manually populate your dataitem. I usually use an integer for the ID..

Or you can read in values from a database and use something like primary key for ID and whatever field you want for value. As long as the ID is unique it will work. Just because you have to put ID and values into the dataitem doesn't mean you have to use both in your code.