-
Jul 21st, 2011, 09:45 AM
#1
Thread Starter
Junior Member
datarepeaterItemTemplate Focus question
Hi again!
I'll try and describe this correctly. a simple datarepeater (databound, winform) with a button on it, clicking the button on the datarepeater opens another form with an uploading routine, you select the file from your hardrive, and you can send the file to it's destination on a server. the problem is when the button is clicked, the previous datarepeater template or instance still has the focus and the file gets uploaded to the wrong place, how can i, when the button is clicked, give focus to the datarepeater template that the button is on. if i click on the template, and then click the button, then the proper focus is true. thanks for any help with this, it's very much appreciated!
-
Jul 21st, 2011, 10:23 AM
#2
Re: datarepeaterItemTemplate Focus question
You might have to explicitly set the focus in the Button's Click event handler. Try calling the Select() method.
-
Jul 21st, 2011, 11:30 AM
#3
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
I tried me.datagridview.select() that didn't do it, but I have a feeling there's more to it than that, one thing i forgot to mention, that the form the button is calling is not databound if that makes any difference, i tried putting the word new in the connection string but that didn't do it. thanks,
-
Jul 21st, 2011, 11:36 AM
#4
Re: datarepeaterItemTemplate Focus question
You were talking about a DataRepeater in your first post, now you're talking about a DataGridView. Which one is it? How would modifying the connection string have anything to do with what you are seeing as a focus issue? I meant calling Select on the actual DataRepeaterItem. Now I'm not so sure what the problem is. Can you please explain further?
-
Jul 21st, 2011, 12:09 PM
#5
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
the datarepeater on form1 has a button that opens a new form (form2) with a datagridview on it, so on form2 there's a button to click to find your file on the hardrive to to upload, click find, find it and it ends up showing in the datagridview on form2, click upload and your done, then when you close form2, and go to the next template on the datarepeater on form1, click the button, form2 comes up again and the previous row on form2 is still there, the focus on form1 is still on the previous form1 template and form2 is showing up with the previous data still in it, now if i manually click on the datarepeater before clicking the button for the second time, form2 shows up empty and good, so somehow i'm trying to make clicking on the button give the new datarepeater template focus before calling form2. i thought modifying the connection string to include new would give the effect i'm looking for but it didn't, thanks a lot, i really appreciate it.
-
Jul 25th, 2011, 09:41 AM
#6
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
anyone know how to give a datarepeater template focus when clicking on a button? when i click on this button on a datarepeater, what ever template has the focus is the one that i get data from. thanks
-
Jul 25th, 2011, 09:48 AM
#7
Re: datarepeaterItemTemplate Focus question
I already tried explaining, you need to get a reference to the DataRepeaterItem that the Button is hosted on, then try calling Select() on that item. Have you done that? If so, please post the code.
-
Jul 25th, 2011, 10:18 AM
#8
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
i'm not sure the right way to make that reference, here's a few things i tried
'FloorPlansBindingSource.ResetCurrentItem()
'DataRepeater11.Select()
'DataRepeater11.CurrentItem.Focused.Equals(True)
' BindingNavigator11.GetContainerControl()
-
Jul 25th, 2011, 10:29 AM
#9
Re: datarepeaterItemTemplate Focus question
Might be something like this:
Code:
If TypeOf button.Parent Is DataRepeaterItem Then
Dim item = DirectCast(button.Parent, DataRepeaterItem)
item.Select()
End If
-
Jul 25th, 2011, 10:42 AM
#10
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
i put that in the button click event, and it's got the squigaly lines under Datarepeateritem11 and message "type datarepeaterItem11 is not defined"
(i tried it without the 11 too)
-
Jul 25th, 2011, 10:56 AM
#11
Re: datarepeaterItemTemplate Focus question
You will need this at the top of your code:
Code:
Imports Microsoft.VisualBasic.PowerPacks
-
Jul 25th, 2011, 11:25 AM
#12
Thread Starter
Junior Member
Re: datarepeaterItemTemplate Focus question
That fixed the error message thanks. the weird thing about this is if i just go to the hardrive and upload files, my program works fine it gets the id from the right template the button is hosted on, but what i'm doing is exporting bitmaps, jpegs, and pdf's out of an old access database one at a time then uploading them into my new program, when i do that, it grabs the id from the previous template for some reason. the users of this program won't be using it that way, they will just have files on their drives and upload them so, maybe it's no big problem. i know it sounds crazy to export files one at a time, but i haven't been able to convert ole objects/packages (the way they are stored in access) to import into sql server, exporting them converts them to their native formats, i have about fifteen hundred to do.. thanks for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|