|
Hi!
I'm using XMLTextReader and GetAttribute in order to parse a XML file. The problem is that the the file isn't 100% valid XML. File begins with many lines of "#####". My application works fine if I remove these lines from the file. But if I don't want to modify it, I keep getting error "Exception System.Xml.XmlException was thrown in debuggee: Data at the root level is invalid. Line 1, position 1."
Is there a way to write a code that doesn't mind these non-valid expression and manages to parse the attribute correctly?
With best regards,
RI
|
|
|
|
|
Hi,
Does anyone know how to do a search for files like in windows using vb.net.
thanks
|
|
|
|
|
Hello, I noticed your comment, and realised i had a similar need not so long ago, so i took it upon myself to create a program, which searches a chosen directory for a chosen file.
This program is basic and still glitchy, but should provide you with information you need on file searching. What is your email, so that i can email it to you.
Posted by The ANZAC
|
|
|
|
|
I'm trying to save the image to sql database, there is error "object must implement Iconvertible" when I run it. Here is my code:
(image is the location + the name of the image)
Try
Dim strFn As String = image
Dim fiImage As FileInfo = New FileInfo(strFn)
Me.m_lImageFileLength = fiImage.Length
Dim fs As FileStream = New FileStream(strFn, FileMode.Open, FileAccess.Read, FileShare.Read)
m_barrImg = New Byte(Convert.ToInt32(Me.m_lImageFileLength)) {}
Dim iBytesRead As Integer = fs.Read(m_barrImg, 0, Convert.ToInt32(Me.m_lImageFileLength))
fs.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Try
Me.SqlConnection1.Open()
If SqlCommand1.Parameters.Count = 0 Then
Me.SqlCommand1.CommandText = "UPDATE HRRecordIndexData SET pdf_location = @Picture WHERE entity_id = @ID"
Me.SqlCommand1.Parameters.Add("@Picture", System.Data.SqlDbType.Image)
Me.SqlCommand1.Parameters.Add("@ID", System.Data.SqlDbType.Int, 4)
End If
Me.SqlCommand1.Parameters("@Picture").Value = Me.m_barrImg
Me.SqlCommand1.Parameters("@ID").Value = Entity
Me.SqlCommand1.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
Me.SqlConnection1.Close()
End Try
If there is everyone knows what it needs to fix at my code, I would very appreciate it .. thanks!
Lisa
|
|
|
|
|
Lisa,
are you sure the field "pdf_location" has type "image"?
Regards
Ray
|
|
|
|
|
Hello, Ray,
I created another field called thumbnail and the datatype is image, and I run it again, the result is the same, it still gave me the same error.
thanks!
Lisa
|
|
|
|
|
Hi,
I have similar code and it works.
The difference is only in parameter type definition :
System.Data.SqlDbType.VarBinary , not image.
Here is my code:
fv =me.openFileDialog1.FileName
Dim fs As New FileStream(fv, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, CInt(fs.Length))
fs.Close()
kom.Connection=conn
kom.CommandText="INSERT INTO PDF (DATA,F_NAME) VALUES (@duom,@failas)"
dim param1 as New SqlParameter("@duom", System.Data.SqlDbType.VarBinary)
param1.Value=MyData
kom.Parameters.Add(param1)
dim param2 as New SqlParameter("@failas", System.Data.SqlDbType.VarChar )
param2.Value=fv
kom.Parameters.Add(param2)
conn.Open
dim res as Integer=kom.ExecuteNonQuery()
|
|
|
|
|
{vb .net 2003}
I'm working on creating a few side panels for my application that will slide in and slide out as needed. I have one docked on the left side, so it will resize with the window and still look the way I want it to. To "slide" it, I'm using a timer that decreases the width of it, making it look like its sliding out. I want to move all the controls in it (labels and picture boxes) to follow the sliding motion but I can't change the width without screwing up how the text looks, so I decrease the left value of the label as I decrease the width of the panel.
My question is this:
Is there a way to adjust the left property of all control in a panel at the same time without having to hardcode each individual label? I thought about doing a control array but then I would need seperate arrays for each type of element. Any idea?
Thanks for your time,
BAM
|
|
|
|
|
Instead of resizing the panel to make appear to slide, try changing it's location so that the panel slides off the left side of the form. The X portion of the Location can be in negative numbers and it should still work.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I tried changing panel1.location.x to a negative number and the panel won't budge. I think its because the panel is docked to that left side.
|
|
|
|
|
That's why. You have to turn the dock off in order for it to work. Just make you Anchor the Top and Bottom portions of the Panel to the form after you get it's dimensions set properly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I figured out what works best for me. Turning off the docking features completely messed up everything that was going on with resizing the window, so I used the approach of decreasing width. To deal with the items inside, I used the Controls array that contains every object in a panel to adjust the width. Heres the code:
For intIndex = 0 to Me. Controls(panel).Controls.Count - 1
Me.Controls(panel).Controls(intIndex).left = Me.Controls(panel).Controls(intIndex).left - operation
next intIndex
With this, operation is set to positive or negative 1, depending on if i'd like to show or hide the item. panel is set to the number that corresponds to the panel. I really don't know how to determine besides trial and error (or trial and messagebox).
Thanks again,
BAM
|
|
|
|
|
i m trying to fetch the file names from a specific path.
.Getdirectories .
but the order of files get changes as seen in windows explorer.
for eg
in windows explorer
a2.txt
a11.txt
a1.txt
and what i am getting is
a1.txt
a11.txt
a2.txt
i want in the same order as seen in windows xp.
can anybody suggest me how to solve
chirag
|
|
|
|
|
You have to sort the files yourself, in whatever control your using to display them. The order of filenames that is returned is not guaranteed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
does anyone fancy helping me with this program , im very new to this and even thought ive got certain books, they only cover vb6 and not .net. if you have msn im ed209_59@hotmail.com thanks
|
|
|
|
|
Help you with what? You haven't said anything about the program!
themusicman9 wrote: if you have msn im ed209_59@hotmail.com
The only people who care about your email address in the forums are spammers!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thats a lie, i care. This forum is about helping each other i am willing to help however i can, when i can, i am however busy with school. But i will offer any assistance i can.
Posted by The ANZAC
|
|
|
|
|
That might have come out wrong, but what I would have said is, be careful who you give the email address to. Especially in an age where spam is thiriving.
|
|
|
|
|
In my project I have a dataset. In the dataset I have added a parameter in tableadapter's selectcommand. In code how can I modify this parameter?
|
|
|
|
|
Show us your code, and we'll show you how to modify it.
|
|
|
|
|
Well, VB generated the code. Here is what I did:
- Created a data source in the Data Source window.
- Opened up the data source in the Solution Explorer.
- Highlited the Table Adapter on the data source object.
- Modified the Command Text propery by setting a field filter equal to '=?'
- VB automatically generates a Parameter for the field filter.
To populate the data table I do this:
MyTableAdapter.fill(MyDataSet.MyDataTable, companyvalue)
It fills the table with records that match the value of companyvalue.
My questions how can I modify the Commant Text and Parameter in code. After the code modifies this I can change the parameter to something else. For example
MyTableAdapter.fill(MyDataSet.MyDataTable, cityvalue)
|
|
|
|
|
dptalt wrote: Well, VB generated the code.
So, what does the generated code look like? (I don't generate code because it frequently produces garbage that is difficult to maintain)
|
|
|
|
|
Hi,
i m passing a foder name from textbox
i want to know wherther ths folder name is present in treeview or not
plz tell me if u know
sanjaya
sanjaya kumar dhar
|
|
|
|
|
Hi,
I think the possible and fastes solution could be when you are adding nodes in treeview as folder names you also enter the nodes key as same folder name and we know the key is unique in treeview.
so when you try to enter new node with same key it will generate error.
try to trap this error.
if error raised it means the node is alreadt present in the tree.
hope this works.
Nitin...
|
|
|
|
|
hi
i need an example how to open word document from
vb.net and also the dll file (reference)
thanks Eyal
eyalso
|
|
|
|