|
|
well simply put.
say i have a word "TEST"
i want a string to build until it finds a match, namely "TEST"
so in this case the loop should
loop thru all the alphabets A-Z to do a check like below
dim out as string
dim arr() as string
arr(1) ="A"
arr(2) ="B"
arr(26) ="Z"
note that variable out is only a single character.
for lp as integer =1 to 26
out = Arr(lp)
IF out="TEST" then
Msgbox("Found")
end if
next
if a single character does not equal the word "TEST" then add a second character to out, like below....
for lp as integer =1 to 26
out = Arr(1) & Arr(lp)
IF out="TEST" then
Msgbox("Found")
end if
next
this should repeat untill out = "TEST"
hope this makes sense but dont know how to better explain the above
thanks though
|
|
|
|
|
Are you aware that computational time would increase as 26^N where N is your test string lenght?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, April 16, 2009 4:37 PM
|
|
|
|
|
Why not just set out to "TEST" since you are bound to find a match (eventually - within 26^N comparisons!)
What is the purpose behind doing it by building out one char at a time?
If we knew that we might be able to suggest a way forward.
Regards
David R
|
|
|
|
|
What the others guys said.
This sounds a lot like you are actually trying to accomplish something completely different from what you are describing here.
What you are describing here, sounds to me like what you think is the solution to the actual problem.
So please describe the actual problem to us.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Coding, I suppose.
BTW: recursion often helps...
BTW2: never heard about combinatorial explosion? [^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, April 16, 2009 6:14 AM
|
|
|
|
|
CPallini wrote: BTW2: never heard about combinatorial explosion? [^]
Thanks for that. I'd done some studying about factorials, and the nCr button on my calculator, but didn't know the proper name for it
|
|
|
|
|
I m Using Vb 6.0 and access.I have more then 1000 records in particular table,now i wmat to update 2 to 3 rows only in that table,then how can i update without loading or updating all records?I m using VSFlexgrid for displaying data.
|
|
|
|
|
Does not Access SQL have a Select statement?
I haven't used Access for years, but from memory it always used to.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Tip: try not to mention that you are using vb6 on this forum.
Like with any database, you can write code in your application that executes an SQL statement.
You just build your update statement in the code, something like:
Dim dbConn As Connection
Set dbConn = New Connection
dbConn.CursorLocation = adUseClient
dbConn.Open "Your connection string here"
Dim MyNewValue As String
Dim SomeValueThatIdentifiesWhatRowToUpdate As String
MyNewValue = "blablabla"
SomeValueThatIdentifiesWhatRowToUpdate = "more blablabla"
dbConn.Execute ("UPDATE MyTable SET MyField='" & MyNewValue & "' WHERE MyOtherField='" & SomeValueThatIdentifiesWhatRowToUpdate & "' ")
Or something along these lines.
My advice is free, and you may get what you paid for.
|
|
|
|
|
I want to load an xml file into my program then extract data from it into text boxes. For loading purpose I would like to be able to have something that looks like the open file dialog. So that I can select different xml file each time load it into my program have it take the layout I would like be able to alter any text then save the alteration and print it out.
|
|
|
|
|
Are you using VB or VB.Net?
VB.Net:
Use an OpenFileDialog, use System.Xml.Linq.XDocument.Load(filePath) to get an XDocument and then recursively get every node. If it has child nodes, recurse further. If not, write the child node text somewhere. To save it, just save the XDocument, and have any editing alter the XDocument itself
So, in summary
Load:
OpenFileDialog. Get filename
System.Xml.Linq.XDocument.Load(FileName)
Get every node
If node has child node: go to previous instruction
Else: write node details
Editing node:
Alter XDocument itself
Saving:
XDocument.Save
VB[1-6]:
Interface with COM. I can't help you here
modified on Thursday, April 16, 2009 6:50 AM [Needed to clarify]
|
|
|
|
|
i am using visual studio 2008 express edition vb
thanks for the info i will have to try that
|
|
|
|
|
Is XDocument a DOM implimentation ? What does it offer over the non LINQ DOM class ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Probably not much that actually matters, but LINQ exposes the xml document's structure and tags to Visual Studio's intellisense. In other words, it makes writing code for a specific xml structure easier for he developer.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Not really that much in all honesty, but it makes XML a lot easier. It works with LINQ far more easily, which is useful if he ever wants to apply the principles to other projects. I'm not certain, but going by this link, it doesn't the XDocument class doesn't appear to be DOM (to be precise, the Remarks and Examples sections imply this). Also, an XElement doesn't require creation from an XDocument, which doesn't tie it down to one particular XML file
|
|
|
|
|
ok here is my code for loading the file
<pre>Imports System.Xml.XPath
Imports System.Xml.Linq
Imports System
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xmldoc As XDocument = XDocument.Load("OpenFileDialog1.FileName")
Dim
OpenFileDialog1.Filter = "Xml (*.xml)|*.xml"
OpenFileDialog1.ShowDialog()
System.Xml.Linq.XDocument.Load(OpenFileDialog1.FileName)
End Sub
End Class </pre>
How do i load node text into text box from here
a simple xml file for testing here person.xml
<pre>
<xml version="1.0" encoding= "utf=8"?>
<Person>
<FName>Keith</FName>
<LName>Ryan</LName>
</Person>
</pre>
thanks
|
|
|
|
|
I have searched for answers on the web, have some good suggestions but they do not seem to fix my problem.
On a web form, I have a report with a sub-report. No matter what I do, I get the error message "Error: Subreport could not be shown."
I can run the subreport as a main report on another page, and it works fine.
I found elsewhere that I have to add a handler for the subreportpreocessing event, and have done so but it does not get called when I step through the code.
Below is some code for the events that lead up to the problem:
==========
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim JobAppID As Integer = Val(Me.DDL_JobAppID.SelectedValue) 'For main report parameter
Dim params(0) As ReportParameter
Me.ReportViewer1.LocalReport.ReportPath = ".\admin\employmentapplicant.rdlc"
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf SubreportDatabind
params(0) = New ReportParameter("vJobAppID", JobAppID, False)
Me.ReportViewer1.LocalReport.SetParameters(params)
Me.ReportViewer1.LocalReport.Refresh()
'End If
End Sub
Public Sub SubreportDatabind(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
Dim MyReportDataSource = New ReportDataSource("DS_References", Me.DS_References)
e.DataSources.Add(MyReportDataSource)
End Sub
==
Also, in the .aspx file I have tried both with and without the following:<LocalReport ReportPath="Admin\EmploymentApplicant.rdlc" OnSubreportProcessing="SubreportDatabind">
Help would be appreciated!!
Dave McDonald
Web Developer
|
|
|
|
|
Well, I haven't used ReportViewer and don't do ASP.NET apps, so my experience is quite limited.
But, from what I can see, everything looks OK. The only question I have is what does the code look like that defines and sets up "MyReportDataSource"? Is this the same source used for the parent report??
|
|
|
|
|
I've got a project that requires merging of several PDF documents into one PDF document. From my research, it is my understanding that this cannot be done without a third party component or library.
Our current plan is to run the merge on a web service call, however we are interested in exploring the costs of using the component in a PC program deployed to our users. It needs to work for .Net 2.0 or higher.
Does anyone have any recommendations for a good one? And/or one that isn't too costly?
|
|
|
|
|
I too would be interest in an answers, as I have a similar requirement, but does not need to a windows or web service.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
You are correct that there is no built-in support for this in .NET.
There are several free libraries that support interaction with PDF files, so you could utilise one of those to write your own merge component. Very very steep learning curve though (Googling 'PDF Files .NET' got hits for all the ones I was aware of, and others).
At the end of the day I suppose it is a cost comparison between doing that and whatever paid-for component you eventually decide on.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi everybody,
i got a problem. i'm developping an vb.net application. now i want to load a word file into a richtextbox with all the formatting text from word.
Or
how can i load the whole word file into a control in vb.net that can support it?
Thanks for your help.
Marc.
|
|
|
|
|
Try loading an RTF file. That has most of the formatting available in Word, and can be opened by Word, Wordpad, and the RichTextBox control
|
|
|
|
|
marclenoir2005 wrote: now i want to load a word file into a richtextbox with all the formatting text from word.
Generally speaking, not possible. The RichTextBox doesn't support the Word file format. You'd have to save the document in RTF format, then load that version into the RichTextBox. Now, there's another problem. The RichTextBox doesn't support the entire RTF specification. Meaning, while Word will save all the formatting and other goodies in RTF format, the RichTextBox doesn't understand it all and will not render the document properly if the document contains formatting it doesn't support.
|
|
|
|