|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) So on the button click event grab the text of the multi line text box then:
Private Sub IbtnSubmit_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles IbtnSubmit.Click
Dim I As Integer
Dim J As Integer = 0
Dim oldI As Integer
Dim oldJ As Integer
Dim colnum As Integer = 0
Dim tmparray(35) As String
Dim tmpstr As String
Dim instr As String = tboxauto.Text
Dim objArrayList As New Collections.ArrayList 'Input parameters
If instr.Length = 0 Then
showmessagebox("You need to copy the Excel section into the text box")
Exit Sub
End If
'Parse through the excel file copied into the textbox
I = instr.IndexOf(Chr(13))
oldI = 0
While I <> -1
tmpstr = instr.Substring(oldI, I - oldI)
oldJ = 0
J = tmpstr.IndexOf(Chr(9))
cleararray(tmparray)
colnum = 0
While J <> -1
If colnum > 32 Then
Exit While
End If
tmparray(colnum) = tmpstr.Substring(oldJ, J - oldJ)
colnum += 1
oldJ = J + 1
J = tmpstr.IndexOf(Chr(9), J + 1)
End While
If tmparray(1).ToUpper = "ISR" OrElse tmparray(1).ToUpper = "HELP DESK TICKET" Then
'skip because this is the header of the excel file
Else
processauto(tmparray)
End If
oldI = I + 2 '2 because of cr and lf
I = instr.IndexOf(Chr(13), I + 1)
End While
End Sub
Private Sub cleararray(ByRef inarry() As String)
Dim I As Integer = 0
While Not (inarry(I) Is Nothing)
inarry(I) = Nothing
I += 1
End While
End Sub
Private Sub processauto(ByVal inarry() As String)
'YOu can write some code here to use the data.
End Sub
Hope that helps.
Ben
|
|
|
|
|
Thanks for the reply, but how will I get the name of the excel file from client machine???
Please help me...
|
|
|
|
|
You don't need the file name. They copy the excel file and paste it into a text box and then press a button. The code I posted parses through the copied excel file.
Ben
|
|
|
|
|
Thanks, but still its not working.Can u please give me an example what is the input given in textbox and how this code works???
I am not getting this line:
instr.IndexOf(Chr(13))
Thanks again.
|
|
|
|
|
When you copy the excel doc and then paste it into a multi line text box, what you get is text where the columns are sepparated by a tab character and the end of the line is delimited by a return character (13).
So since the user copies the data from excel and pastes it into your textbox on your website and then presses a button. You can parse the excel data and then do something with it.
Ben
|
|
|
|
|
Now its giving error on the line :
J = tmpstr.IndexOf(Chr(9))
What for chr(9) is???
|
|
|
|
|
Char 9 is the tab character which is what each column should be sepparated by. What is the error you are getting?
Ben
|
|
|
|
|
Actually I am having only one column in excel file which is Email ID column. I suppose I will have to remove the second while loop. Is it so??
Its giving Error:
Object reference not set to an instance of an object.
On Line:
If tmparray(1).ToUpper = "ISR" OrElse tmparray(1).ToUpper = "HELP DESK TICKET" Then
|
|
|
|
|
If you only have one column then it makes things a lot more simple. YOu just need to look for the Chr(13). You should be able to remove a lot of the code I posted.
Ben
|
|
|
|
|
Will u please help with that???
|
|
|
|
|
Ah no, I have already given you my code. I think you need to work with what you have and try to get it working. If you have a specific problem I would be more then happy to help.
Ben
|
|
|
|
|
Thanks a lot its working fine now. Thanks again...
|
|
|
|
|
i hv stored some image into folder images like this
HttpFileCollection File=HttpContext.Current.Request.Files;
HttpPostedFile File1=File[0];
string fn_imgProduct=System.IO.Path.GetFileName(imgProduct.Value);
string locationImage=Server.MapPath("../Images/")+fn_imgProduct;
File1.SaveAs(locationImage);
now i want to delete this from image folder.
please help me how i can delete it
alok tripathi
|
|
|
|
|
File.Delete ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
System.IO.File.Delete(putfilepathhere);
Hope that helps.
Ben
|
|
|
|
|
Hi
I have created image controls dynamically. when i click that image control someother page should be displayed as a popup window how to do this??
my code is :
ImageButton imga;
Panel pana;
LiteralControl LL1;
private void Page_Load(object sender, System.EventArgs e)
{
string idvalue;
idvalue= Request.QueryString["id"];
int cnt;
cnt=Convert.ToInt32(Request.QueryString["count"]);
Session["impath"]="audio_release/"+ idvalue +"";
int cnt1;
if (cnt % 3==0)
{
cnt1=cnt/3;
}
else
{
cnt1=((cnt/3)+1);
}
for (int i=1;i<=cnt1;i++)
{
imga = new ImageButton();
pana=new Panel();
imga.ID = "img" +i.ToString();
imga.Width=200;
imga.Height=150;
imga.ImageUrl="audio_release/" + idvalue + "/"+ i +".jpg";
pana.ID="pl1"+i.ToString();
LL1= new LiteralControl(" ");
pana.Controls.Add(LL1);
pana.Controls.Add(imga);
mainpan.Controls.Add(pana);
imga.Click +=new ImageClickEventHandler(Imagea_Click);
}
}
protected void Imagea_Click ( object sender, ImageClickEventArgs e )
{
ImageButton imga = ( ImageButton )sender;
string s=imga.ImageUrl;
popup('s');
Response.Redirect("audioimage.aspx");
}
here i want to display audioimage.aspx as popup window.
plz let me know if u know the ans
Thanks in advance.
Haritha
|
|
|
|
|
in Imagea_Click event you call javascript function .
in that function you can define window.open method i.e.
open (URL, windowName[, windowFeatures])
protected void Imagea_Click ( object sender, ImageClickEventArgs e )
{
ImageButton imga = ( ImageButton )sender;
imga.ImageUrl="javascript:load()"
//popup('s');
Response.Redirect("audioimage.aspx");
}
in html page you can write:
function load()
{
window.open("audioimage.aspx","mywindow","menubar=1,resizable=1,width=350,height=250");
}
Thanks
Raghvendra Kumar Roy
|
|
|
|
|
Hi
what is complete URL TRACKER. whats is its purpose
any idea how can we implement the complete URL- TRACKER.
Regards,
Srinandan
|
|
|
|
|
how to implement remember me next time feature in asp.net 1.1. plz provide help
|
|
|
|
|
If user wasnts to be remembered, write a cookie to their machine when they log in with their userID, (or whatever..) - and test for this cookie in page_load and if it exists log the user in automatically (or just fill in thier username, whichever you want to do.)
Research reading and writing cookies in ASP.NET
Fred
|
|
|
|
|
:(where i put the "Macintosh is at 9.8m/sec² ",plz give me detail plz
|
|
|
|
|
One post is enough.In BTW why are you creating the new thread.
Regards,
Satips.
|
|
|
|
|
What are you asking ? The quote means the only way to speed up a Mac is to throw it out the window.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The text you are referring to is a signature used by ExpertComing. When you setup a profile on CodeProject.com you can create a signature that gets appended to every message you post in the forums. So if his signature had been "Thanks Have a Nice Day" it would have said that at the end of the message - it has nothing to do with his actual response. So when you see "The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo" that is just his signature. You can ignore that part of his response.
|
|
|
|
|
Wow, that is funny. I never thought I could find someone that (fill in the blank). I got a hell of a laugh out of that.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|