|
THANKS
Previously my code was like this
If txtfunckey.Text.Substring(1, 5).StartsWith("PV000") Then
newRow("PROP_CATEGORY_ID") = Property_Category_ID
Debug.Write(txtfunckey.Text.Substring(1, 5))
' Later Provision for PVNTR001
ElseIf txtfunckey.Text.Substring(1, 5) = "PVDIF" Then
newRow("PROP_CATEGORY_ID") = PVDIF
Debug.Write(txtfunckey.Text.Substring(1, 5))
ElseIf txtfunckey.Text.Substring(1, 5) = "PVNTR" Then
Debug.Write(txtfunckey.Text.Substring(1, 5))
newRow("PROP_CATEGORY_ID") = PVNTR
Else
MessageBox.Show("The was no Provision for this Functional, Ask Vuyiswa Add Provision for IT", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information)
newRow("PROP_CATEGORY_ID") = DBNull.Value
Debug.Write(txtfunckey.Text.Substring(1, 5))
End If
so i decided to add case's , mybe the nested If's caused this . but i will try to Debug.
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
You are using txtfunckey.Text.Substring(1, 5).
If your string starts with the values you state above you will always leave out the first character of your comparison and you will be including what ever character comes next. If txtfunckey.text is 5 characters or shorter you will get a System.ArgumentOutOfRangeException
|
|
|
|
|
I've never seen a case block like that, is that VB.NET syntax ?
YOu should set a default. You should also trace through to see what the values are when you get a null ( add a default and set a breakpoint there is a good way to do this )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am writing data to a text file and have a field that repeats. I only need/want the first instance of the data. This is may sql statement:
mySelectQuery = " "
mySelectQuery = mySelectQuery & "SELECT ARInvoice.InvoiceNo, ARInvoice.MonthBegBal, ARInvoice.MonthActivity, ARInvoice.OriginalAmount,
mySelectQuery = mySelectQuery & "ARInvoice.InvoiceDate, ARCustomer.ID, ARInvoice.PONumber, ARInvoice.DueDate, ARTerms.Description, "
mySelectQuery = mySelectQuery & "ARInvoice.OurOrderNumber, ARInvoice.Type, ARInvoice.SalesTax1Amt, ARInvoice.SalesTax2Amt, "
mySelectQuery = mySelectQuery & "ARInvoice.SalesTax3Amt, ARInvoice.FreightCharges, ARInvoice.Status, ARCustomer.CurOpenCredits "
mySelectQuery = mySelectQuery & "FROM ARTerms RIGHT JOIN (ARCustomer INNER JOIN ARInvoice ON ARCustomer.SKARCustomer = ARInvoice.FKARCustomer) ON ARTerms.SKARTerms = ARInvoice.TermsCode "
mySelectQuery = mySelectQuery & "WHERE (((ARInvoice.Status)=0))Order By ARCUSTOMER.ID"
ARCustomer.CurOpenCredits is the field that repeats. So the results (I have condensed) of my text file look like:
27312 460640.89 6/18/2007 BLACKWARRIOR CT0603 7/18/2007 11839.14
26936 14721.37 1/29/2007 BLACKWARRIOR 8-1082 2/28/2007 11839.14
27313 5575.68 6/18/2007 BLACKWARRIOR CTD-1600 7/18/2007 11839.14
I would want it to be: (notice that the 11839.14 appears only one time instead of three times)
27312 460640.89 6/18/2007 BLACKWARRIOR CT0603 7/18/2007 11839.14
26936 14721.37 1/29/2007 BLACKWARRIOR 8-1082 2/28/2007
27313 5575.68 6/18/2007 BLACKWARRIOR CTD-1600 7/18/2007
My code to write to the file looks like:
While myReader.Read()
field(0) = myReader.Item(0)
field(1) = "Sage-Rolligon"
field(2) = Math.Round(Convert.ToDouble((myReader.Item(1) + myReader.Item(2))), 4).ToString("###0.00")
field(3) = Math.Round(Convert.ToDouble(myReader.Item(3)), 4).ToString("###0.00")
field(4) = myReader.Item(4)
field(5) = " "
field(6) = " "
field(7) = myReader.Item(5)
field(8) = myReader.Item(6)
field(9) = myReader.Item(7)
field(10) = Convert.ToString(myReader.Item(8))
field(11) = " "
field(12) = Convert.ToString(myReader.Item(9))
field(13) = " "
field(14) = myReader.Item(10)
field(15) = " "
field(16) = Date.Today
field(17) = Math.Round(Convert.ToDouble((myReader.Item(11) + myReader.Item(12) + myReader.Item(13))), 4).ToString("###0.00")
field(18) = Math.Round(Convert.ToDouble(myReader.Item(14)), 4).ToString("###0.00")
field(19) = " "
field(20) = " "
field(21) = myReader.Item(16)
If field(14) = "1" Then
field(14) = "I"
End If
objStreamWriter.WriteLine(String.Join(ControlChars.Tab, field))
End While
Thanks in advance for any assistance!
STEPHANIE
|
|
|
|
|
Well, you've got nothing in your While loop that tracks what the current value is. If the one you just read is the same as the value you're tracking, you just don't put anything in that field. If it's different, then you put that value in the field and make the new value to current tracking value.
|
|
|
|
|
I tried an if statement with no luck. Can you give me a little more info as to how to track what the current value is?
Thanks!
Stephanie
|
|
|
|
|
If trackingValue <> rowValue Then
field(whatever) = rowValue.ToString()
trackingValue = rowValue
Else
field(whatever) = ""
End If
|
|
|
|
|
I'm somewhat inexperienced/new in this area and while I totally understand the concept here, the execution is another story. This is what I understand. My value (in this case the "current open credit amount" is "held" or "stored" in myReader.Item(16). I'm setting the field(21) equal to myReader.Item(16) and then writing it the text file.
I know or think I know that I need to check what that value is and if it IS equal to the value in the "row" before then I want it print nothing in the text file. If it is NOT equal to the value in the "row" before then I want it to print as it is.
Please don't laugh... this is an excerpt of the code:
<br />
field(20) = " "<br />
Credits = myReader.Item(16)<br />
<br />
If credits <> rowvalue Then<br />
field(21) = rowvalue.ToString()<br />
credits = rowvalue<br />
<br />
Else<br />
field(21) = ""<br />
End If <br />
I get an
'System.NullReferenceException - Object reference not set to an instance of an object.' error. This happens when it actually encounters a number. Thank you for all of your help!!
Stephanie
|
|
|
|
|
On which line does this happen?? This exception pops up when you try to use an object that is actually Nothing instead of an instance of something.
|
|
|
|
|
On
credits = rowvalue.ToString()
I tried to set
rowvalue = String.Empty
It compiles with no errors. And, following the code it runs until it meets an actual number. And, then it throws the error. I read an article about the error that suggested using the rowvalue = string.empty. If I use this nothing writes to the text file.
Thanks!
Stephanie
|
|
|
|
|
I changed the code to
credits = myReader.Item(16)
If credits <> rowvalue Then
rowvalue = credits
field(21) = rowvalue.ToString()
Else
field(21) = ""
End If
And it appears to be working! I'm having to use sample data working from home, but will test with real data in the a.m.
Thanks for your help!!!
Stephanie
|
|
|
|
|
Im using a VB. net PL i just want to know how to customize gridview...tnx
sunshine
|
|
|
|
|
Any way you like. Do you want to change the column definitions, how it looks, if it shows edit/delete buttons, what those buttons call, or something else ?
All of these things are covered in MSDN and other articles, in detail that will help you a lot more than a forum post can hope to.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK. In which of the thousands of ways would you like to "customize" the DGV? Or should we just guess?
|
|
|
|
|
how can i change the color of the heading and how to change its font style
sunshine
|
|
|
|
|
|
Hai to all dear friends, I am developing an 2 tier windows application in vb.net . In this project i used web service to access data .
I am seeking problems in updating and adding new records in my sql database through web service .
Please help me .
also if u may suggest any other option to create 2-tier application .
I will very very thankful to u .
Yogendra Dubey
email :- mesagetoyogi@gmail.com
|
|
|
|
|
I'm not sure what you're looking for here. The web service is going to have to expose a few public methods for you to call to tell it to how update the database. I'd imagine you'd have to supply a method for each of the possible SQL update methods, like UPDATE, INSERT, and DELETE.
|
|
|
|
|
Can anyone help me with a code to open a cash drawer in VB.Net 2003. I am stuck please assist me. I am new to hardware commands.
rgds
initial
|
|
|
|
|
you think we all are idiots here?
colgateas900197
|
|
|
|
|
imla wrote: I am stuck
inside the cash drawer?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
LOL!!!
|
|
|
|
|
We can't answer the question because you haven't said anything about how the cash drawer is connected to the machine, nor what commands to send, or anything else we need to know to give you a useful answer. Well, other than telling you what you need to do would be covered in the manual for the cash drawer...
|
|
|
|
|
Dave Kreskowiak wrote: Well, other than telling you what you need to do would be covered in the manual for the cash drawer...
Which is what we were bound to say anyhow....
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Oh, crap! Did I give away too much information??
I don't know...It seem'd like I was over stating stating the obvious. Or was I being too dramatic? My performance wasn't too "over the top", was it? What do you think?
|
|
|
|