ASP is not my specialty so I can't address the edit-mode or the postback, but for the events, the short answer is to: create a custom control that inheirts your first Template collumn. add a public delegate and event within it. raise the custom event on the first templatecollumns changed event. public delegate sub delIndexChanged(sender as object, e as system.eventargs) public event evtIndexChanged as delIndexChanged Private thing(sender as object, e as system.eventargs) handles me.selectedindexchanged RaiseEvent me.evtIndexChanged(sender,e) End sub in your mainpage (the one with the grid), Replace the template col reference with one to your custom control. once you instantiate the grid cols, add a handler for the evtIndexChanged that points to a sub with AddHandler MyGrid.cols(idx).evtIndexChanged , AddressOf where has the appropo parameter list for the delegate signature. that will fire whenever the first col changes. I would use it to gen a filterstatement for a dataview. to fire the col directly you can just RaiseEvent Object.Event(parameters...) I think. postbacks will complicate this. I just read somthing about the asp2.0 callback model, and they claim there are now ways to update stuff on the UI (via server side processing) without posting back on the client. you may want to look into it but as I said web isnt my area of expertise. Hope That Helps, FrankyT hey...slang is the vernacular for the vernacular...wow
FrankyT
Posts
-
How to Handle the event raised by control inside the Template column of a DataGrid? -
What is this Code snippet meaning?It's a metatag. there are certian tags taht handle specifics about how a class compiles and integrates into the VS Environment. for instance before a public property causes the propety to show up in the forms designer properties window. that is evidence that VS is prebuilding certian parts of an object to facilitate its WYSIWYG interfaces (like to provide intellisense on new components, custo user controls etc.) the metadata tells the environment which parts to pre-compile in this case. Web service methods use a similar tag to indicate that teh code gen should create an XML interface and description of the method so it can be enumerated to clients and called via soap. Think of it as Code defining Code. that is what meta means in any sense. metadata is data about or describing data. gives me a headache myself... hope that satisifies your curiosity, Frank hey...slang is the vernacular for the vernacular...wow
-
How to properly add records to a database through formatted databound textboxesLook into Parse and Format. You use those to modify the on the data in and the out for presentation and storage. IE: you have a DB that some yahoo created a collumn with "y","Y","n", and "n" in it. you want to bind it to a checkbox. if the feild was a bit/Boolean, you could directly bind it with the datasource property or by using me.checkbox.databindings.add(new binding(me.dataset1., "", "Checked ")) ...or somthing a lot like that. as an aside You can do really neat things with lookup tables and comboboxes with this command by binding the display(human readable text feild) and value(the pk feild) members oif the combobox to teh lookup table, and then binding the selectedvalue property to teh real datatables fk feild into the lookup table. I can't quote you the code to parse (to morph data from the UI to fit the database) and format(for the data coming out of the dataset into the UI), 'casuse I design my databases with some forthought, but basically you create events for the feild parse and format, and within those, you mutate back and forth. Below are some assorted ramblings with a tip or two buried within them, mainly on binding context and currencymanagers. it isn't directly in your question but if you like check it out. within your binding context are all your datasiource objects (datasets, dataviews, and datatables) each instance of which has a currency manager that points to and iterates through the datarows within. Currency managers are Great but theres a gotcha. you only get one per instance of a datasourceobject. thats Why I create dataviews to show the datatables in my datasets when I'm binding them. also no more than one control can be bound to a feild on a particular datasourceobject. but you can have multible views sitting atop the same datatable and bind two controls to the same feild but on the other view. AS a result I always get my currency managers by using dim thing as CurrencyManager = ctype(me.bindingcontext(""),currencymanger) whenever I need one (and you can just use the whole expression instead of ) Now there are some advanced members to this lib that intellisense won't point out to you by default. I recomend that you disable "Hide Advanced Members" in teht Visual Studio options. My favorite is ctype(me.bindingcontext(""),currencymanger).current.row("") to access the value in a row. not nesecarily the best form but it gets the job done. have fun, Frank
-
Authentication codeVB Forms or ASP(1/2)? in ASP you set Impersonation to a specific user account in the web.config. Google it and you'll find many walkthroughs. you can also have your app run in IIS as another user (by defualt your user is annomoyus) in the inetmngr This is security sensitive stuff so I'd work with a server admin (who knows IIS) when your reviewing possibilities on this one, if it's a work project. In windows forms an app runs under the context of the user session the app is spwaned from, unless its a service, in which case the user account is set in the installer or the services.msc. Just give the desktop users permissions to the directory, or add them to a group and provide it the needed permissions. Hope that helps, Frank hey...slang is the vernacular for the vernacular...wow
-
How to properly add records to a database through formatted databound textboxesAccess can be quirky especially with autonumbers so that may be where your issue is also are you calling = .newRow (for strong typped tables) or = .Rows.newrow (for weak types) (this gets an appropo autonumber and inits all feilds in the new row with default values) Befor calling .rows.add()? make sure your not specifing the index that the row is added at. let the framework do that. Hope that helps, Frank hey...slang is the vernacular for the vernacular...wow
-
help me"adobe(pdf)|*.pdf |document(doc)|*.doc|jpeg(jpg)|*.jpg" Each pairing is | delimited eg. "type_HumanReadable|FileSystemMask". then each pair is futher delimited by a pipe eg. "adobe(pdf)|*.pdf |document(doc)|*.doc" also watch out for .jpeg s I think you can add ", *.jpeg" to the end, but I can't quite recall off the top of my head. oh and the other had some good points. look over his/her post. next time just highlight "Openfile.Filter" and hit F1 to look at the help doc. I have to look this one up every time... hey...slang is the vernacular for the vernacular...wow
-
How do I wait For a Web Transction to complete? [modified]I'm looking for ways get my app to wait until a network stream is fully returned. Unfourtunatly NNTP uses differant stream terminators for the output of each command (if any at all), and that makes this a little awkward. My VB app calls an NNTP server via the TCPClient and reads the response. Pretty standard you'd figure. I'm having trouble with the requests that return more than one line of data, however. Basically it seems that my code is rushing to execute faster than the response comes in so the read loop is terminated because the netstream peek is empty. The response is still comming and if the app would wait a min, it would recieve the subsequent data. When i step through (or even break for a sec) the code works fine, but if I run through it without breaks, it only reads the first line. Typically I use My.application.doEvents to address these issues in forms but the read code is in a backend classlib. I've tried some simple threading algorithms (running on a sepperate thread that dosn't sleep, or pausing the main thread) but they don't seem to help either. If anyone could point me in the right direction on this I'd be most appreciative. TIA Frank hey...slang is the vernacular for the vernacular...wow -- modified at 3:06 Monday 29th May, 2006
-
system.drawingForm.Desiginer.vb files are new to net 2.0 (VS 2005) they contain the auto generated code caused by draging things onto the designer and manipulating their properties. it's the equivilant to to the "Windows Generated Code" region of a VS 2002 or 2003 Form. Typically only changes made to the designer get written to this file. you may have botched a property. try importing the lib desire. copy local = false is fine for system namespaces, since they are part of the core framework (%windir%\Microsoft .Net\Framework\-VerNum-\). you only need copy local when your referencing a custom or third-party lib. Good luck hey...slang is the vernacular for the vernacular...wow
-
aspx web pages..........actually I just read somthing about a thumbdrive with a full appache server on it. works on most any PC it's plugged into. nifty hey...slang is the vernacular for the vernacular...wow
-
How do I capture my network userid and display it on a form?in 2k3 I always used system.environment.username which returned just the short name. or you coul djust substring the returned name since that convient "\" is a perfect dilimeter. dim y as string = system.environment.username dim x as string = y.substring(y.laastindexof("\") + 1, y.length) good luck hey...slang is the vernacular for the vernacular...wow
-
register ocx at .net 2003dude, kool it on the dup posts. that said, to register an ocx, use the regsrv32 command in the shell. running command strings in VB.net is pretty easy, with teh shell verb dim x as string = "regsrv32 mscomm32.ocx /s" shell(x, -windowstate-, -wait-, -timeout- ) you can add this code to the install package by overriding the Install method. there is a great tutorial on this site about "Conditional Installer packages" that discusses how to do just that, so you can ask where to put desktop and quicklaunch shortcuts. it's pretty good. Good luck hey...slang is the vernacular for the vernacular...wow
-
how i can redefine stringyou may be having scope issues. if your declaring a local variable in vb with "Dim", then taht variable is only valid inside that block. EX sub main() thing() otherthing end sub private sub thing() dim x as string = "Hello" debug.writeline(x) end sub private sub otherthing() debug.writeline(x) 'This line causes an error. end sub the second reference to 'x' causes an error because it was declared within a block. to declare globals within a class or module, use : Private x as string = "Hello" sub main() thing() otherthing() end sub private sub thing() x = "Hello" debug.writeline(x) end sub private sub otherthing() debug.writeline(x & " Again") 'No error this time end sub Globals are just one answer to a scope issue. paramater passage and other techniques exist. you'll learn 'bout 'em sooner or later Good Luck hey...slang is the vernacular for the vernacular...wow
-
Sending email using Sql Server 2000 CDOSYSrun a port sniffer on the server and see if any of the ports used are blocked on the firewall, or rely on IP or layer 2 broadcasts. it may be an SMTP relay issue as well. if your sec policy disables the right that might be it. I would typically advise against sending email from SQL (at least SQL2000). we had issues with it at work. hey...slang is the vernacular for the vernacular...wow
-
"Sub" is short for...?I've always though it was 'subroutine', and took it for granted...now I wonder... hey...slang is the vernacular for the vernacular...wow
-
vb.net code questionsee...easy answers hey...slang is the vernacular for the vernacular...wow
-
Can't Drag Tables out of Server Explorer in VS 2005...For some reason I can't drag tables out of server explorer onto a form or UI designer. I have no connectivity issues; I can connect to the datasource and open tables, create stored procs, etc from within VS 2005. I can create datasets and dataadapters through teh new datasource wizard. it's the weirdest thing... the little '+' appears on the icon indicating that the designer is a valid place to drop the table, but it dosn't create the objects. this issue has occured accorss several reinstalls of both VS and WinXP so unless I got a bad CD, it shouldn't be a software thing... any ideas? hey...slang is the vernacular for the vernacular...wow
-
vb.net code questionheres how I would do it. remember, in vb, try not to do it the hard way. most of the time you'll find an easy one. BTW somthing seems wrong with your keypress event handler, I'm used to Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress now if your working in vb 6 or VBA this code may not work. by the way if this is homework, at least paraphrase... geta little edu for your money. Sub Text_KeyPress(KeyAscii As Integer) If isAllNumbers(uiEnterInterNumTextBox.Text)Then KeyAscii = 0 uiEnterInterNumTextBox.Text = KeyAscii End If End Sub Private Function isAllNumbers(ByVal teststring As String) As Boolean Dim isgood As Boolean = True For Each c As Char In teststring If Not Char.IsDigit(c) and not(c = ".") and not( c = ",") Then isgood = False Exit For End If Next Return isgood End Function hey...slang is the vernacular for the vernacular...wow
-
Parsing text with VBAsimple answer: copy the .csv to a backup file open the copy in word and find/Replace "," with " ". then rename the file extension to .html then open it with your favorite browser. if the information displays as desired, copy out the desired text (cntrl + a or Shift + End help a lot) and paste it into another word or text document. that should work... as for an script or applet, that would take some time and trouble. depending on the html, it would probably be quite dificult to define all the things you need to strip out. probably longer than editing it cy hand... hey...slang is the vernacular for the vernacular...wow
-
reset formon the topic of email, this is how I do it for VB forms. it also works when exposed through a web service. Imports system.net.Mail public class mailer Private email As MailMessage Private webmailer As System.Net.Mail.SmtpClient Private Sub sendMail() email = New MailMessage("Sender Email", "Reciepient Email", "Subject Text", _ "Body Text") webmailer = New System.Net.Mail.SmtpClient("SMTP Server Name as String", _ "SMTP service port: usually 25") With email .Attachments(0) = New Attachment("c:\SomeFile.txt") .Attachments(1) = New Attachment("c:\SomeOtherFile.txt") End With webmailer.Send(email) End Sub end class server admin has a big impact on whether this will work. if it fails it may not be the code, but the smtp server configuration. good luck hey...slang is the vernacular for the vernacular...wow -- modified at 21:35 Tuesday 4th April, 2006
-
Help with array codeok here: Dim i() As Integer 'create a array of ints with 0 length For j As Integer = 0 To 1000000000 ReDim Preserve i(j) ' redefine the array in memory, keeping the existing values i(j) = j Next return i advice: 1) everything is reference in VB (except integral primatives like ints ) 2) arrays are declared to have a lengthh adn don't like it when their boundries are broken 3) mixing .count and .length lead to trying to remember which is "0 based" and which is "1 based" 4) if you get an indexOutOfRange violation check your iterators 5) redim is your friend 6) collections are often a better choice 7) avoid mixing collections and arrays (collections are 1 based and always have >= 1 member) 8) use for each when ever applicable (another reason to avoid mixing arrays with collections) this really should all be in your textbook. Look it up... good luck hey...slang is the vernacular for the vernacular...wow