|
Thanks John for the info. It is the sort of info i needed to look at before i tried again
Regards Lawrence
Zeldacat
Regards
Zeldacat
|
|
|
|
|
I want to read from a file and save that data in variables. It worked fine when I used global variables in the same class. Now I am "cleaning" my code and want to make it more OOP. So, I have created another class that has those variables and I created get statements and set statements to control access to the variables. I need help using the set statements to save the variables.
Before OOP code.
FileOpen(3, path + "\" + "baseconfig.txt", OpenMode.Input, OpenAccess.Read, OpenShare.LockRead)<br />
Input(3, Database)<br />
Input(3, Connectionstring)<br />
Input(3, Table)<br />
Input(3, custNameField)<br />
Input(3, OrderNumField)<br />
Input(3, materialField)<br />
Input(3, TruckNumField)<br />
Input(3, Haulerfield)<br />
Input(3, LoadFinishedField)<br />
Input(3, TargetField)<br />
Input(3, GrossField)<br />
Input(3, TareField)<br />
Input(3, DatabaseType)
With OOP Not working-- I don't know how to put a method in the following code or even if it would work.
FileOpen(3, path + "\" + "baseconfig.txt", OpenMode.Input, OpenAccess.Read, OpenShare.LockRead)<br />
Input(3, Me.thisDatabaseChoice.SetDatabase(?))<br />
Input(3, Me.thisDatabaseChoice.SetConnectionString(?))<br />
Input(3, Me.thisDatabaseChoice.SetTable(?))<br />
Input(3, Me.thisDatabaseChoice.setsetcustNameField(?))<br />
Input(3, Me.thisDatabaseChoice.SetOrderNumField(?))<br />
Input(3, Me.thisDatabaseChoice.SetmaterialField(?))<br />
Input(3, Me.thisDatabaseChoice.SetTruckNumField(?))<br />
Input(3, Me.thisDatabaseChoice.SetHaulerfield(?))<br />
Input(3, Me.thisDatabaseChoice.SetLoadFinishedField(?))<br />
Input(3, Me.thisDatabaseChoice.SetTargetField(?))<br />
Input(3, Me.thisDatabaseChoice.SetGrossField(?))<br />
Input(3, Me.thisDatabaseChoice.SetTareField(?))<br />
Input(3, Me.thisDatabaseChoice.SetDatabaseType(?))
I do have one parameter in each of these methods. How can I make this work? Can I? Do I have to store them in a variable first and then do the set statements?
|
|
|
|
|
Why are you using methods when property get/set accessors are more appropriate?
I suggest you read this article[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Maybe you didn't read my post closely enough? I AM using get and set accessors. My question that I need help on is not how to use get and set accessors in general. It is can I use them in the example that I posted. I will post again for you in this reply.
I am reading from a file. I am currently placing them in variables. But I want to place them in Class variables that I already created successfully and are using throughout my program.
EX: Right now.
FileOpen(3, path + "\" + "baseconfig.txt", OpenMode.Input, OpenAccess.Read, OpenShare.LockRead)
Input(3, database)
Input(3, connstring)
Input(3, table)
Input(3, custNameField)
Input(3, orderNumField)
Input(3, materialField)
Input(3, truckNumField)
Input(3, HaulerField)
Input(3, LoadFinishedField)
Input(3, targetField)
Input(3, grossField)
Input(3, tareField)
Input(3, databasetype)
I want to be able to use my setACCESSORS
I get an error when I try.
Input(3, SetDatabase()) 'As an example.
Do you know of a way to us the setaccessors in the Input(3, ) code? Or do I have to use the variables that already work?
|
|
|
|
|
vb.net /.net-framework 1.1
i created a class which inherits from datagrid.
i had to override onmousedown, but now the inherited grid doesn't sort and resize columns anymore.
with hittestinfo.type i can determine whether the user clicks on columnresize or on column, but how do i have to induce sorting and resizing now?
|
|
|
|
|
If you did an override on the onmousedown , you may need to supply code to do the sorting and resizing.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
yes, i know. but how do i do that?
ah, found out.
modified on Thursday, January 24, 2008 6:09:43 PM
|
|
|
|
|
|
I don't think anyone is going to give you complete code to encrypt and compress mpegs; would you??
Considering what is required and what is involved, I would look for a component that already does it. Why reinvert the wheel? Have a look at ComponentSource[^]
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
No1 : We dont work for you
No2 : We dont do work for other people
No3 : You dont respect us, you come here and say ...urgent!!!! to us
Until you start using Google or Respecting
We will ignore you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
You expect people to simply do your work for them? Your post is very rude. You are demanding "detailed guidance," or complete source code to your project when you most likely haven't made any attempt, or done any research to get it done. Part of being a software developer is the ability to reserach and think on your own. Oh wait, it's urgent, huh? Oh I guess it's okay then. Posts like this will get you ignored 99% of the time. That's great though, hopefully when someone here won't do your project you will get fired, then it will be one less person posting crap like this. You will find a job flipping burgers will better suit you.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Justin Perez wrote: I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I would use it repeatedly on the OP.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Justin Perez wrote: You will find a job flipping burgers will better suit you.
Hopefully he won't encounter people who wants their burger URGENTZ!!-ly
|
|
|
|
|
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
zeeshi_24 wrote: send me the complete code in vb.net or c#
It does not work like that around here. You need to try and do your own work, and when you are stumped, ask for help.
zeeshi_24 wrote: .i need help in encryption and compression of video file (mpeg)..
Google it.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
<br />
Public Sub log_error(ByRef msg As String)<br />
If g_Trace = 1 Then<br />
On Error Resume Next<br />
FileOpen(255, VB6.GetPath & "\err.log", OpenMode.Append)<br />
PrintLine(255, msg & " " & Today & " " & TimeOfDay)<br />
FileClose(255)<br />
<br />
End Sub<br />
Please tell me how i will convert this code into vb.net.....
I will be very much Thankful.
|
|
|
|
|
soniasan wrote: how i will convert this code into vb.net.....
Meet my friend, google.com[^]....
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Public Sub LogError(ByVal message As String)<br />
<br />
Dim filename As String = System.IO.Path.Combine(Environment.CurrentDirectory, "err.log")<br />
Using writer As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(filename, True)<br />
writer.WriteLine(message & Date.Now.ToString(" dd.MM.yy HH:mm:ss"))<br />
End Using<br />
<br />
End Sub
Hope this helps
Tom
|
|
|
|
|
How can I read a text or csv file by ado.net.The following code is working fine with vb 6.0 but when I try to use the same code with vb.net 2005 it gives me an error at <b>Rcdfile.open </b>line.
The following error I am getting.
[Microsoft][ODBC Text Driver]'6.0' is not a valid name.Make sure that it does not include invalid character or punctuation and that it is not too long.
Here is the code which I am using to open the file.
Dim Conn As New ADODB.Connection
Dim RcdFile As New ADODB.Recordset
Conn.Open("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & mPath & " ; ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False")
RcdFile.Open("Select * From " & Me.OpenFileDialog.FileName & "", Conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
Any idea where I am wrong.
THanks in advance
<div class="ForumMod">modified on Thursday, January 24, 2008 9:39:36 AM</div>
|
|
|
|
|
I got the problem.Actually I was giving the filename with the path in the file open line where it should be only filename without path.
|
|
|
|
|
hi all
i have the Following function, that inspect a string and return an integer for a certain partten. Every time i run this Function it returns "0", for example if i pass "PV000000" it will return "0" if i pass "GEOSS001" it will return "0", what is wrong
<br />
Private Function FindCategory(ByVal strFunc_key As String) As Integer<br />
Dim intval As Integer<br />
<br />
If strFunc_key.Substring(0, 4) = "GEOSS" Then<br />
intval = 12<br />
ElseIf strFunc_key.Substring(0, 4) = "PV000" Then<br />
intval = 1<br />
ElseIf strFunc_key.Substring(0, 4) = "PVDIF" Then<br />
intval = 2<br />
ElseIf strFunc_key.Substring(0, 4) = "PVNTR" Then<br />
intval = 3<br />
End If<br />
Return intval<br />
<br />
End Function<br />
<br />
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hi,
consider this line
If strFunc_key.Substring(0, 4) = "GEOSS" Then
the substring function takes two argumets in above line. first is start index & second is length of string which you specify 4. so how can you compare this substring(4 character) to other string(Geoss,pv000 etc)
use following statement
If strFunc_key.Substring(0, 5) = "GEOSS" Then<br />
intval = 12<br />
endif
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hi Rupesh Kumar Swami
Thank you very much, i understand, the mistake i made, is that i started counting the string am comparing from "0" instead of "1"
Thanks its working
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Firstly you need to test for 5 characters not 4 e.g. "GEOSS" contains 5 characters
Secondly what happens if not of the conditions are true?
Personally, I would use a SELECT CASE rather than nested IFs
example :-
Private Function FindCategory(ByVal strFunc_key As String) As Integer<br />
Dim intval As Integer<br />
<br />
Select Case strFunc_key.Substring(0, 4) <br />
CASE "GEOSS"<br />
intval = 12<br />
Case = "PV000" <br />
intval = 1<br />
Case "PVDIF" <br />
intval = 2<br />
Case "PVNTR" <br />
intval = 3<br />
Case Else<br />
intval = 0<br />
End Select<br />
Return intval<br />
<br />
End Function
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|