|
Please don't ask twice. Please try to use intelligent headers. EVeryone here wants help. Please make it clear what you're asking about. Visual Basic.NET does not have any control which references locations by A5 and A10, or has an ActiveCell, It seems likely you're talking about Excel, but VBScript or interop ? How are we to tell ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Matthew Leggett wrote: I have two locations referenced by
point1 = A5
point2 = A10
I need to use these variables in a calculation ie
=sum(point1:point2)
however this doesn't work?
when I use this statement
ActiveCell.Offset(0, 3).Value = "=sum(point1:point2)
any work around / solution?
if you require additional info let me know?
Try this:
ActiveCell.Offset(0, 3).Value = "=sum(" & Point1 & ":" & Point2 & ")"
This is of course assuming that you have Point1 and Point2 declared as strings.
|
|
|
|
|
Does anyone know how to shutoff/disable the automatic "feature" of changing the time of a date field when changing time zones? I want my dates to be left alone. I know I can change the field to type string but extra conversions would be necessary to compensate for changing the type. (this auto-feature happens when I am using a webservice)
Thanks,
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
You cannot remove the time component of the datetime type. You can however display any part of that component using format. You can also refuse to store the time value when writing it to the database (I do this everywhere EXCEPT where I explicitly need to time component) by using TODAY instead of NOW.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi, i am still a novice vb programmer.i want to know one thing.i want to write some code so that it will control objects outside my form.i mean generally we write code to work with the objects(say command button,list box etc.) that we place on our form.but how can i manipulate and take control of the objects outside my form.say,i want to write code so that a message box will be shown if a user double clicks on drive C: in my computer window.i think i need to take help of API.but i can't understand how to do it.anyone can help me out there? i am just freaking out.plz help me.
romance
romance
|
|
|
|
|
romance - see the one votes, they signify a stupid question, you have an inflated idea what you can do as a programmer specifically as a VB programmer. I imagine a very good developer (probably C++) with a deep knowledge of win32 api may be able to manage this but a newbie, not a chance.
Try something simple first, create an application that executes some business logic, retrieves and stores data, you know simple stuff. After you have spent a number of years gaining a well rounded knowledge of the programming tools available to you, think of this question and laugh at yourself.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i didn't mean to offend someone.yet you offended me.i think you don't know the answer of my question, nor do you have any knowledge of programming.
thanks and please don't disturb anyone by answering stupidly
romance
|
|
|
|
|
It's not that I don't know the answer to your question it's that your question does not make sense. It also indicates that you have no knowledge of the use and limitations of VB.
My response may have upset you but you will remember it, therefore I consider it a job well done. Get some understanding of the tools you propose to use, think about the projects you want to do, start working on the projects and when you run into a problem with coding, come back and we will help.
Note that no one responded to your question except to indicate it deserves a 1 vote.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi,
here i want to know, can i make a new variable, "Dim Variable as type" at the run time
when the my application load up it will create a new variable that can store a data.. is that possible? how can i make it?
|
|
|
|
|
shee_dee86 wrote: here i want to know, can i make a new variable, "Dim Variable as type" at the run time
when the my application load up it will create a new variable that can store a data.. is that possible? how can i make it?
Your question is not clear. Please try to explain what you wanna do.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
shee_dee86 wrote: "Dim Variable as type" at the run time
when the my application load up it will create a new variable that can store a data.. is that possible?
That is what it does
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Is it generating code at runtime? If yes then CodeDom or Reflection will help.
|
|
|
|
|
No, that is not possible.
Try to ask about what it is that you want to accomplish, instead of asking about how you think that it should be solved.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Last year, MikeinNH wrote an outstanding article on how to allow runtime SQL queries from form objects:
http://www.codeproject.com/KB/database/TableAdapter.aspx?display=Print
This almost all works for me except when I try to match database DateTime values. It doesn't act like any of the other variables and never finds a match. I don't think the problem is in SQL, I think it's in VB. My "Start Date Time" logic is below. Ideally, I'd like to use a between clause (eg. Between 'sdt' and 'edt') to make user records searchable in a time window that they choose.
Dim sdt As String = (sdtBox1.Text)
If sdt <> "" Then
stWhere = "DateTime > '" + sdt + "%' "
Else
The sdtBox1 value I'm testing with is '8/14/2008 00:00:00:001' and I can see that verbatim on a message box output, it just won't work in the SQL query. Is there a conversion or something that I need to do? Thanks
|
|
|
|
|
Just quickly looking at your code - it looks like the text date format is fine. What is the '%' for though? I think that would cause the query to error off. If you were using a LIKE statement maybe, but not a >.
Open up SQL profiler when your VB code runs and see the exact statement being sent into SQL. Paste that query in QA/ SQL Manager to see the results.
|
|
|
|
|
Right you are. I copied that from a LIKE statement.
When I removed the %, it still ignores my DateTime conditions, but I will check profiler to see what's happening.
Thanks.
|
|
|
|
|
Change "DateTime > '" + sdt + "%' "
to: " DateTime > '" + sdt + "%' " space added to the front. The where clause may have been all jumbled together.
|
|
|
|
|
Tried that, watched Profiler:
VB still didn't send that clause. It took my hardcoded front half ("Select From Where") plus the following AND condition successfully. But completely skipped DateTime.
I will keep playing with it, as long as it isn't an issue with text conversion or a DBDateTime property, then it's probably a syntax or logic error.
Thanks again for your help.
|
|
|
|
|
>>VB still didn't send that clause. It took my hardcoded front half ("Select From Where") plus the following AND condition successfully. But completely skipped DateTime.
Ok. it sounds like your doing everything right.
Last ditch effort: put a breakpoint on the FillByWhere function (assuming your following the article logic closely). Check the value on the WhereExp variable. What is the exact string after this line has run: "Me._commandCollection(0).CommandText += " WHERE " + WhereExp"?
That should be exactly what's being sent to the db. If the value is wrong there, press CTRL+L and go up the call stack to see where the value is being excluded.
Good luck~!
|
|
|
|
|
Yes! Thank you. I didn't know about SQL Profiler and since I've been watching that has pinpointed the problem. My textbox input data had an extra pair of ''s
Result:
SELECT * from Route_Call_Detail where RouterCallKeyDay > 148875 AND DateTime > ''2008-08-14 06:38:42.153''
It's corrected and I'm on my merry way.
|
|
|
|
|
|
To whom ever can guide me a little on file stream usage.
I have a decent number of binary files that I must read only the first line of. Normally I declare a filestream as such (and use a binaryreader to use the filestream):
Dim fs As New FileStream(strFile(0), FileMode.Open, FileAccess.Read)
Is there a way to change the source file dynamically, or do I have to declare a new file stream for each file? The Name property is read only.
Thanks!
|
|
|
|
|
Come fellow code project alumni - show thee the light!
|
|
|
|
|
Try this...
Dim fs as FileStream
Dim FilesToProcess as New List(Of String)
FilesToProcess.Add("c:\test.txt")
FilesToProcess.Add("C:\boot.ini")
For Each fileToProcess as String in FilesToProcess
fs = New FileStream(strFile, FileMode.Open, FileAccess.Read)
'TODO: whatever you need to do with the file
Next 'filetoProcess
|
|
|
|
|
You're still declaring a new FileStream for each file.
|
|
|
|