|
Thank u verymuch for ur timely help.
|
|
|
|
|
Sir,
Fine seeing ur reply immediately.its a great effort.
one more help please.i have form with some input fields and i insert those values into database and below the form i have a datagrid to which i view the data which add to database i.e. whole data that are present inthe database.
but my problem is the data gets added but its getting repeated in viewing the datagrid.i tried using datagrid.refresh method it doesnt work . is there anyother method to view the data in the datagrid without getting repeated.kindly help me.
and i thank u in advance for ur effort.
|
|
|
|
|
take a dataset fill it using a DataAdapter the assign this dataset to grid's datasource property.
When ever you save the data then first call dataset.clear() it would clear existing data in dataset, then refill the dataset using DataAdapter and reassign dataset to grids datasource.
this would prevent showing repetative entries in grid.
...Pranjal
|
|
|
|
|
Thank u verymuch for ur timely help
|
|
|
|
|
I have an Excel File in the directory: D:\Test.xls
the file has a worksheet "sheet1"
I want to name an user-defined range such as :
name: Myrange
range: sheet1!A1:F1
it's easy to operate it in the excel application
but i want to know how to use .Net code(VB.NET OR C#) to solve it?
i use oledb drive to connect an excel file,through the method GetOleDbSchemaTable()
i know that user-defined range is also consided to be a table type
but i don't know how to solve it using .net code
help me
work for living,work for interests,work for girlfriend
|
|
|
|
|
I have a project in VB6 that uses context menus that are dynamically created. I then use the index on the menu items to perform an action when the user selects it. If they select the 5th item I look at in internal array to do some processing. How can I do this in VB. NET I do not see a way to attach an index to the menu item in a context menu. I could have 20 menu items created dynamically and it could be a real pain to have to re-write all mu procedures to use names instead of indexes.
|
|
|
|
|
You have to use an array of MenuItem s. I don't know the exact VB.NET syntax, so I'll give you some C# code. Hopefully, you'll be able to understand it:
MenuItem[] contextItems;
...
contextItems = new MenuItem[2];
contextItem[0] = new MenuItem();
contextItem[0].Text = "Menu Item 1";
contextItem[1] = new MenuItem();
contextItem[1].Text = "Menu Item 2";
foreach(MenuItem item in contextItems)
item.Click += new EventHandler(ContextOnClick);
...
void ContextOnClick(object sender, EventArgs e)
{
int index = -1;
for(int i = 0; i < contextItem.Length; i++)
if(contextItems[i] == sender)
index = i;
if(index >= 0)
{
}
} I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-- modified at 16:55 Monday 12th September, 2005
|
|
|
|
|
Sorry for you but controls (like menuitems) do not support array indexing anymore. But that doesn't mean that there are newer (and better) ways of doing it. Here's a quick one.
Let's suppose the actions are stored in an array called act. Now assign to every menu item the "equivalent" index in the TAG property. Then hook all the click event to a single procedure:
private sub myclick(sender as object,e as...) handles menu1.click,menu2.click,...ecc
myaction=act(cint(ctype(sender,menuitem).tag))
end sub
Every menuitem click will go back to a single procedure (like in the array in VB6). By extracting the TAG field you can get the index (has to be converted from a string).
Hope it helps.
|
|
|
|
|
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
|
|
|
|