|
Thanks for your help, but I must still be missing something.
If I create a context menu there is no Tag field. But I wish to read the menu items from a file and add them dynamically to the menu at run time.
Now I have to have a procedure that handels that as you list an example private sub myclick(bla bla bla) handles menu1.click, menu2.click and so-on. Problem is I do not know what all teh different menus are at design time. So how do I do that?
signed
lost in menu *^*%^%&(, 2005
|
|
|
|
|
my fault I read normal menus rather then context, and I did not know that context menu miss the tag field. But since context menus are made of menuitems you should have the tag field available.
Anyway I give you another way of seeing at it.
When you have private sub x(sender as object,e as...) handles x.click,y.click,z.click
the sender paramter is the one that caused the event, in our case the clicked one. If you want to check it you can always do it this way:
if sender is x then
elseif sender is y then
elseif sender is z then
end if
if you have stricton you may have to cast sender to x object type.
|
|
|
|
|
Can someone tell me whats wrong with this code. Every time I execute it I get a "Operation must use an updateable query." error message. I have changed all the rights to the .mdb file so I am sure it isn't that.
I don't know if its the query itself, I may just have the wrong syntax.
HELP!!!
Public Function AddFixtures(ByVal HT As String, ByVal AT As String)
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
sConn += "Data Source=C:\Inetpub\wwwroot\webapplication5\football.mdb;"
sConn += "Persist Security Info=False"
sCommAdd += "INSERT INTO Fixtures (Fixtures.HomeTeam, Fixtures.AwayTeam ) VALUES ('" + HT + "', '" + AT + "')"
oConn = New OleDbConnection(sConn)
oConn.Open()
oCommAdd = New OleDbCommand(sCommAdd, oConn)
oCommAdd.ExecuteNonQuery()
oConn.Close()
End Function
|
|
|
|
|
Two things...
First,
sCommAdd += "INSERT INTO
Are you really adding this string to something else? Keep in mind that Jet doesn't support compound statements.
Second, it's not enought to give the ASPNET account Write permissions to the file. You MUST give it Write permissions to the folder that the .MDB file is in. This is because Jet must create an .LDB file in the same directory so long as the database is opened. Without the ability to create that .LDB file, your request will fail with the error message you're getting.
PRB: ASP Returns 'Operation Must Use an Updateable Query' Error[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Basically all I am trying to do is add a new row to my table in the database from an ASP.Net form.
My database has an
ID(Autonum), Date, String1, String2
So there is already data in there, so what I want is to add a new row in, for which it will automatically generate an Autonum.
At present of course I figure just to get it imputting the 2 strings. So I choose the 2 strings from List Boxes, and send them to my add function which I wrote above. And all I want that to do is add it to the end of the table generating an autonum.
I was thinking my syntax on the SQL statement was wrong.
-- modified at 18:35 Monday 12th September, 2005
|
|
|
|
|
First, Dave is right, you are adding to an existing command, when you should be creating a single command.
Second, it looks like you're adding the two strings only, does the date have a default value ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
An insert statement into access should be written this way.
Dim sqlStr as String = "INSERT INTO Fixtures(Fixtures.HomeTeam, Fixtures.AwayTeam) Values (?,?);"
Dim dbComm as new OleDbCommand(sqlStr, oConn)
dbComm.Parameters.Add("HomeTeam", OleDbType.VarChar, 50, "HomeTeam")
dbComm.Parameters.Add("AwayTeam", OleDbType.VarChar, 50, "AwayTeam")
dbComm.Parameters("HomeTeam").Value = HT
dbComm.Parameters("AwayTeam").Value = AT
Try
oConn.Open()
dbComm.ExecuteNonQuery()
Catch ex as Exception
......
Finally
If oConn.State = ConnectionState.Open Then oConn.Close()
End Try
The reasons behind this method are:
1) You can control the length of text that HT or AT will be. Generally set the same size the db allows.
2) You can clearly see what is suppose to be done. Stepping through this could helps debug a problem.
Hope this helps.
-- modified at 20:35 Monday 12th September, 2005
|
|
|
|
|
I have a VB6 application I upgraded to .net. The upgrade wizzard added a bunch of code to my forms that I am not sure I fully understand. I am having a heck of a time trying to get my forms to load properly. Can anyone give some advise how best to do it? I have a lot of code that aranges things on the forms and then sizes them but it does not seem to work consistently, the code appears to execute but then the form appears to ignore sizing and such. Any advise or articles that may enlighten me would be appreciated...
|
|
|
|
|
My best advise is to skip the upgrade wizard and rewrite the project. The wizard introduced a bunch of code that, besides amounting to a pile of spaghetti, makes your code very difficult to discuss with other people because pieces of code wind up everywhere.
If your code is moving and resizing controls on load, you're more than likely conflicting with the code in your Form's "Windows Forms Designer Generated code" section. As for how to fix that, only stepping through the code and doing a line by line review is going to tell you what you have to do. I don't know of any articles anywhere that will tell you what you have to do to fix the wizard converted code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
if you want to reset some of you form properties or change them you can go to windows form desirner generated code and in InitializedComponent you will see the properties of each component on your form(they are seperated with comments) then you can chenge them.
If you delete a line of code it means that you have reset it! If you like to have a better performance you can use property windows(View>property windows or F4) if you want to reset a property right click on it and then select reset.
thats all!
have a nice programming day!
|
|
|
|
|
I have a working database and a 'DetailView'. I've added a ListBox which databound to the same dataset (it works too). But when I select an item off the ListBox, I would like the detailview update to the selected item (in the ListBox).
What do I need to do or where do I need to look?
I'm a nooobie and my only book is on VB.Net 2003.
|
|
|
|
|
How would i print the contents of a axwebbrowser control to a printer specified in a print dialog.
I am trying
PrintDialog1.Document = CType(AxWebBrowser1.Document, System.Drawing.Printing.PrintDocument)
PrintDialog1.ShowDialog()
but get the error: Specified cast is not valid.
Thanks for any help
|
|
|
|
|
|
I would like to use the Erl property of the Error object in my error logging routine. Erl uses line number labels in the source code and when the code is formatted correctly Erl gives the line number where an error occurred.
I am looking for a utility program that will read VB.NET and ASP.NET programs, and insert the line number labels that can be used with Erl.
Does anyone know where I can share or buy this kind of program?
Thanks,
Margaret
|
|
|
|
|
Erl only works if your using the old error system of VB6 in your application. This means using On Error Goto whereever or On Error Resume Next , in which case, you'll already have these labels in your code.
I HIGHLY suggest abandoning this practice. You really should be using Try/Catch blocks. If you look at the InnerException, Source, TargetSite, and StackTrace properties of the Exception that was thrown, you'll get far more usable information than what's in the Err object of VB6.
For this reason, I doubt very much that you'll find the utility that you're looking for.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i am trying to create a file using a simple form and as the file is created. i try to access the file using other application it gives error that :- cannot access file as been sued by some other process
i have disposed all the object properly but the error is still there. can any one help.
application is made using vb.net 2003
|
|
|
|
|
Do you mean that you are attempting to access the file before it is closed? If so, then what you are seeing is a valid exception since a second application (process) cannot access the file whilst it is in use. This is a basic locking mechanism to prevent the contents of files being corrupted. In this case you need to close the file in the first application before it can be used in the second.
...Steve
|
|
|
|
|
|
Hi!
I am having some problems using WSE3.0 and kerberos authentification. I wondring if some could help me with the code to:
1. How to get the current users kerberostoken?
2. How to use this kerberosToken to setClientCredentials on the client?
I`m getting a wse910, error, that I dont understand.
My code:
Dim KerbProxy As New WSKerberos.ServiceWse
KerbProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim kerbToken As KerberosToken = New KerberosToken("MyComputername", "MyDomain")
KerbProxy.SetClientCredential(kerbToken)
KerbProxy.SetPolicy("Clientkerberos")' Policy created with 'wse3.0
textbox1.text = kerbProxy.HelloWorld
-- modified at 8:14 Monday 12th September, 2005
|
|
|
|
|
Hi,
I am having trouble extracting the Makernote contained in the EXIF data in a JPEG image from a digital camera. I am able to successfully extract the data contained in the makernote tag, however I cannot decode the data (ie, get the long focal length, short focal length, etc). I have seen the makernote information for different camera makes, such as Canon and Nikon (eg. http://www.burren.cx/david/canon.html[^]), but I cannot seem to work out how to match up the tag name and offset value to the data I extract from the EXIF data. Hopefully this makes sense.
Is anybody able to help me with this, ie provide any code samples or even pseudo code? Thanks in advance.
Cheers
|
|
|
|
|
I have 3 projects in VB.NET that I have included under 1 solution.
Project 1 is a class library that contains 1 class to describe a set of colours to be used in an application design.
Project 2 is a class library that contains a number of classes and windows forms.
Project 3 is a windows application.
Project 3 has an new instance of the class in Project 1, and an instance of a form in Project 2. When Project 3 uses the form in Project 2, the form has a public property where it can get and set the class type in Project 1. Everything first compiles OK and I can run the application, but every now and again the Studio IDE throws a build error saying that the class cannot be converted, when Project 3 tries to set the property in Project 2 using the instance of the class from Project 1. To stop this error I have to restart Studio, remove Project 1 from the solution and compile the solution again. Everything then works OK again for a while.
Is this a known issue in VB.NET, is there anything else I need to do to stop these intermittant compile errors.
Jason
|
|
|
|
|
I have created a simple xml file
<?xml version="1.0" encoding="utf-8"?>
<Event>
<Exception>
<Type>Error</Type>
<UserID>username</UserID>
<ERROR_ID>erroridID</ERROR_ID>
<ERR_DESP>Err_description</ERR_DESP>
</Exception>
</Event>
Now i want to append this xml file. I want to add a new exception in it. Any ideas.
-- modified at 5:09 Monday 12th September, 2005
|
|
|
|
|
What did you use to create the xml? You may want to look into the System.Xml namespace - it has a lot of nifty objects and methods. I would say you could use the XmlDocument to load the current xml and then use all the wonderful methods to alter it the way you want it.
|
|
|
|
|
Say i have this Xml file
<Books>
<Book type="1">
<Author>Peter</Author>
<Section>1</Section>
</Book>
</Books>
and when i add one more book then i want the output to be
<Books>
<Book type="1">
<Author>Peter</Author>
<Section>1</Section>
</Book>
<Book type="2">
<Author>Johnr</Author>
<Section>2</Section>
</Book>
</Books>
the code i am using
Dim WriteXMLFile As XmlTextWriter
Dim fs As FileStream = New FileStream("C:\Err.xml", FileMode.Open)Dim reader As New XmlTextReader(fs)
Dim reader As New XmlTextReader(fs)
WriteXMLFile = New XmlTextWriter(fs, ISOEncode)
Dim doc As New Xml.XmlDocument
'load file
doc.Load(fs)
Dim root As XmlNode = doc.SelectSingleNode("//Books")
If root Is Nothing Then
'if this is a new document create root
root = doc.SelectSingleNode("//Books")
Else
'create node
'get root node named users
Dim Usersnode As Xml.XmlElement = doc.SelectSingleNode ("//Books")
'add the new node
Dim newNode As Xml.XmlElement = doc.CreateElement("Book")
'add attributes
newNode.SetAttribute("type", m)
'add children nodes if any
Dim child As Xml.XmlElement = doc.CreateElement("Author")
child.InnerText = txtAuthor.Text
newNode.AppendChild(child)
child = doc.CreateElement("Section")
child.InnerText = txtSection.Text
newNode.AppendChild(child)
'add new node to users node
Usersnode.AppendChild(newNode)
m += 1
End If
'save doc
doc.Save(fs)
The output i am getting
<?xml version="1.0"?>
<Books>
<Book type="1">
<Author>Peter</Author>
<Section>1</Section>
</Book>
</Books><?xml version="1.0"?>
<Books>
<Book type="1">
<Author>Peter</Author>
<Section>1</Section>
</Book>
<Book type="2">
<Author>Johnr</Author>
<Section>2</Section>
</Book>
</Books>
Can you help?
|
|
|
|
|
Strange that cause when i took your code and tested it, it gave me the correct result. Try the code below it -
<br />
Dim doc As New Xml.XmlDocument<br />
'load file <br />
doc.Load("C:\Err.xml")<br />
Dim root As XmlNode = doc.DocumentElement<br />
<br />
If root Is Nothing Then<br />
'if this is a new document create root <br />
root = doc.CreateElement("Books")<br />
Else<br />
'add the new node <br />
Dim newNode As Xml.XmlElement = doc.CreateElement("Book")<br />
'add attributes <br />
newNode.SetAttribute("type", 3)<br />
'add children nodes if any <br />
Dim child As Xml.XmlElement = doc.CreateElement("Author")<br />
child.InnerText = "rr"<br />
newNode.AppendChild(child)<br />
child = doc.CreateElement("Section")<br />
child.InnerText = "rr"<br />
newNode.AppendChild(child)<br />
'add new node to users node <br />
root.AppendChild(newNode)<br />
End If<br />
'save doc <br />
doc.Save("C:\Err.xml")<br />
<br />
|
|
|
|