rapture 134 Posting Whiz in Training

You didn't mark it as solved, are you still stuck?

Did you find this site?

http://www.freevbcode.com/ShowCode.Asp?ID=2298

rapture 134 Posting Whiz in Training

Sure no problem

Dim newName As New FileInfo("filename.gif")
   
   newName.MoveTo("filename2.gif")

This should work. You can look at fileinfo.moveto() or file.move() for more information

here is an example

http://www.example-code.com/vbdotnet/rename-file.asp

you can google "vb.net rename file" and get more.

Does that help?

rapture 134 Posting Whiz in Training

Well just searching on this site gave me some responses to this question, a google search on

vb.net how to write to the event log

brought up a ton of things. And last but not least have you used the help feature in Visual Studio? I looked for

"write to event log"

and got some interesting material. In other words, did you make any attempt to figure it out and you don't understand something or do you just want us to do it for you?

(I'm not trying to be a jerk, I'm actually trying to help.)

*hint, within the items I have stated there is a block of code that would be extremely useful to you. :)

rapture 134 Posting Whiz in Training

You don't mention if you have to use substring to get the extension or if that is just the method to grab it you decided to use so I'll ask another question . . .

Is there any reason you are not using path.getextension() ?

extension = Path.GetExtension(fileName);

You can get this info from a google search on C# path.getextension or msdn is here: http://msdn.microsoft.com/en-us/library/system.io.path.getextension.aspx

(wondering because .aspx is four while .doc is three etc.)

ddanbe commented: Nice! +4
rapture 134 Posting Whiz in Training

Then why didn't he mark it as solved?

rapture 134 Posting Whiz in Training

Hey, this semester I have to take a class in statistics, will you guys do my homework for me in that one too?

* maybe it's not an assignment, it's a lab or a final exam by way of program writing. :)

rapture 134 Posting Whiz in Training

I'm just a guy trying to learn so take my advice with a grain of salt -
first off, I agree with the others, and they are not heartless, just tired of a lot of people working on a project for school somewhere who want us to write their code for them.

If I'm not mistaken what you want is something like this

Left(somevariable, 3)

transfers to

somevariable.Substring(0,3);

at least I think that's correct.

(By the way, look at the number of threads they have marked as "solved" - they are willing to help, they just want some effort from the poster first...)

rapture 134 Posting Whiz in Training

I'm assuming you can make the button open the new form?

if not - here is a good site to help you with that part as well
http://www.devcity.net/PrintArticle.aspx?ArticleID=94


if you get it - tell us what you did and mark the post solved for others to view.

extra references
http://www.developerfusion.com/samplechapter/4375/building-windows-applications/9/
http://www.startvbdotnet.com/forms/form2.aspx

rapture 134 Posting Whiz in Training

It seems like the only think you need to do is make three more forms with a label on them displaying the message in the proper language. Then make the button open that form.

rapture 134 Posting Whiz in Training

By example what do you mean? There are examples that are close to what you need to do on the links I sent you. You can also do the google search to see other stuff. If you're asking someone to code your assignment for you so you can see how to do it then it defeats the purpose of you having the assignment at all.

(You'll find people here very willing to help you when you get stuck but not so willing to do the project for you)

Let us know if you're stuck and show us your code and we will help you through it

rapture 134 Posting Whiz in Training

By example what do you mean? There are examples that are close to what you need to do on the links I sent you. You can also do the google search to see other stuff. If you're asking someone to code your assignment for you so you can see how to do it then it defeats the purpose of you having the assignment at all.

(You'll find people here very willing to help you when you get stuck but not so willing to do the project for you)

Let us know if you're stuck and show us the code you have and we will help you through it

rapture 134 Posting Whiz in Training

This is an interesting subject and one I hadn't considered. There is some stuff on MSDN - http://msdn.microsoft.com/en-us/library/756hydy4.aspx

an interesting approach for starters although just a pick not http://www.beansoftware.com/ASP.NET-Tutorials/Dynamic-Web-Sites.aspx

I found a great site here http://www.c-sharpcorner.com/UploadFile/mosessaur/aspnetlocalization02042006165851PM/aspnetlocalization.aspx?ArticleID=96602e53-0fb1-44ec-a67b-1c68b05eb2e1


But if you do a google search on multilanguage website or asp.net multilanguage website you find a ton of ideas

By the way - Are you in Ghana Africa? I have friends in Ghana and one of them used to work in the IT field. They have a ministry called African Hope. . . . Good luck with your project

rapture 134 Posting Whiz in Training

Filipe11

Don't guess, look for an answer and then post a question. It helps when you show you're trying. I know it's frustrating but you're never going to go anywhere in programming if you just rattle off a bunch of guesses.

Read this
http://www.techotopia.com/index.php/C_Sharp_List_and_ArrayList_Collections

And what does your textbook say about using lists? ( I assume this is a course project or assignment of some sort)


*** And LizR is right - use the built in help function to help you figure things out as well

rapture 134 Posting Whiz in Training

Ok, you're going to have a couple of steps to solve this I think. (I'm a noob in programming as well so don't expect a ton)

First thing I see is your error :"Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

I found this:


"* CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

This error is produced by a number of sources.
1. If you call an object that requires parentheses () after the command, you'll get this error. Ex. database.Open() not database.Open
2. Using an assignment operator as opposes to an equality operator"

from: http://www.developerfusion.com/article/5385/highperformance-net-application-development-architecture/16/

It comes from your code here:

for (int i = 0; i <= customerNumber; i++)
            {

                [I][B]dataGridView1.Columns.GetNextColumn;//[gvCustnumber];***********************[/B][/I]
            }
rapture 134 Posting Whiz in Training

What do you have that is throwing the error? And what error are you getting?

If you just want examples of VB.Net and SQL statements look here
http://www.startvbdotnet.com/ado/sqlserver1.aspx


if you want help with your problem show us what you have, we can't just do it for you.

rapture 134 Posting Whiz in Training

I think you should have marked the post solved for him as this is a different question bro

C# conditional OR operator is ||


http://msdn.microsoft.com/en-us/library/6a71f45d(VS.80).aspx

rapture 134 Posting Whiz in Training

There are ways to get help by paying but it would be much better if you can do it yourself. We will be glad to help you but you need to help yourself first.

1. Start by mapping out what you need to do in plain english, pseudocode or a flowchart
2. Make sure your logic is correct
3. Start with any little pieces you know how to do

It's amazing how once you get started things start to come together. If you get stuck then you can post what you're trying to do and what code you have so far and we can help you through it. But you're not getting helped by us doing a project for you. It won't help you on a final either which usuallyl forces you to code some.

rapture 134 Posting Whiz in Training

I've got this book and it's pretty good as well.

http://oreilly.com/catalog/9780596527433/

rapture 134 Posting Whiz in Training

Correct,

However I will give you these tips to start:

1. Think about how you want this to work
2. Write it out using plain english, pseudocode or a flowchart
3. Go over what you have and make sure your logic fits in with the suggestions given already
4. Start with whatever you feel is the easiest and work on it in smaller modules.

Once you get going it will be amazing how fast things start to come to you. Sometimes the hardest part is getting things on paper first.

rapture 134 Posting Whiz in Training

RPC is Remote Procedure Call in the services.

rapture 134 Posting Whiz in Training
rapture 134 Posting Whiz in Training

ah - I'm using C# as well but I thought you were using web forms instead of windows forms


Did you get your problem solved?

rapture 134 Posting Whiz in Training

Have you bound the columns as well? I've used:

<asp:BoundColumn 
	DataField="RequestDate" SortExpression="RequestDate" HeaderText="Date Request Entered" DataFormatString="{0:MM/dd/yyyy}">
		<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>

<asp:BoundColumn 
	DataField="PriorityName" SortExpression="PriorityID" HeaderText="Priority">
		<HeaderStyle Width="50px"></HeaderStyle>
		<ItemStyle HorizontalAlign="Left" VerticalAlign="Top"></ItemStyle>
		<FooterStyle HorizontalAlign="Left" VerticalAlign="Top"></FooterStyle>
</asp:BoundColumn>

also do you have the sort expression in the code?

http://www.dotnetjunkies.ddj.com/Tutorial/E169C6D4-D335-4D2B-AE3F-918EE3161815.dcik

Did that help?

rapture 134 Posting Whiz in Training

Yes - here is one that is pretty straight forward for setting it up

http://www.geekpedia.com/tutorial97_Basics-of-using-DataGrid.html

now to be able to sort them make sure you have allowsorting = "true" in the html of the datagrid as well as sortexpression in the html: here is an example I have used

<asp:datagrid id="dgrdRequest" 
			    style="Z-INDEX: 100; LEFT: 88px; POSITION: absolute; TOP: 168px"
				runat="server" Width="616px" Height="96px" HorizontalAlign="Left" GridLines="Vertical" CellPadding="3"
				BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#999999" AutoGenerateColumns="False"
				AlternatingItemStyle-BackColor="#DCDCDC" HeaderStyle-ForeColor="#FFFFFF" HeaderStyle-Font-Bold="True"
				HeaderStyle-BackColor="#6600ff"  AllowSorting="True" tabIndex="5" 
                onitemdatabound="dgrdRequest_OnDatabound" 
                onsortcommand="dgrdRequest_SortCommand" >
<asp:BoundColumn 
					    DataField="RequestDate" SortExpression="RequestDate" HeaderText="Date Request Entered"
						DataFormatString="{0:MM/dd/yyyy}">
						<HeaderStyle Width="50px"></HeaderStyle>
					</asp:BoundColumn>
rapture 134 Posting Whiz in Training

Set a breakpoint and step through the program - my guess is that you don't hit the true ever.

Otherwise you may need to display more code

rapture 134 Posting Whiz in Training

Here is my code. I get error: No value given for one or more required parameters.

Dim DBAdd As New OleDbCommand

        DBAdd.Connection = objConnection


        DBAdd.Connection.Open()
        DBAdd.CommandText = "INSERT INTO Table1 (RecordsID,Material,Component,VID,PID,DownloadPriority)
VALUES(11,'Materialtexttext','ComponentTexttext','vidint','pidint',prtyint)"


        DBAdd.ExecuteNonQuery()
        I tried using update command of OLEDB Data adapters also by adding new row.
But still I could not get record inserted in database.

and try using code tags

rapture 134 Posting Whiz in Training

I can't follow this either - I see

B.T.Columns.Add("SHOP_CODE");

is in red so I assume that means that is where you get the error?

I don't see where SHOP_CODE is declared.

(and remember, I am new to C# and programming in general so don't be too harsh if I missed something obvious)

rapture 134 Posting Whiz in Training

Thanks guys,

I had them both declared - I had the brackets misaligned . . . hard to get used to those things after not using them in VB.Net . . .

rapture 134 Posting Whiz in Training

scru - I sent you the entire class in pm I don't normally do that but explain why in the message. . .

ddanbe,


it's probably me - I've used VB.Net at work but we are switching to C# and I have to get better at the differences.

In VB.Net I had

Private Function BuildUserList(ByVal p_intSendToRoleID As Integer) As String

        Dim dstUsers As New DataSet
        Dim drwData As DataRow
        Dim strUserList As String

        Try
            dstUsers = User.GetUsersByRole(p_intSendToRoleID)

            For Each drwData In dstUsers.Tables(0).Rows
                strUserList &= CStr(IIf(IsDBNull(drwData("Email")), "", Convert.ToString(drwData("Email")) & ";"))
            Next

            Return strUserList

        Catch ex As Exception
            Throw
        End Try

    End Function

it filled the dataset when calling the User class . . .

will C# not fill it with:
dstUsers = User.GetUsersByRole(p_intSendToRoleID);

rapture 134 Posting Whiz in Training

ok, I'm asking another question now....

Previously I had code to add the requester and asignee emails, if the are both empty then I need to build the list. Here is my code:

private string BuildUserList(int p_intSendToRoleID)
{
    
    DataSet dstUsers = new DataSet();
    DataRow drwData = default(DataRow);
    string strUserList = null;
    
    try 
    {
        dstUsers = User.GetUsersByRole(p_intSendToRoleID);
        
        foreach ( drwData in dstUsers.Tables(0).Rows) 
        {
            strUserList += (string)(Information.IsDBNull(drwData("Email")) ? "" : Convert.ToString(drwData("Email")) + ";");
        }
        
        return strUserList;
    }
    
    catch (Exception ex) 
    {
        throw;
    }
    
}

private string BuildUserList(int p_intSendToRoleID) gives me an error at string and
DataSet dstUsers = new DataSet(); gives me an error at DataSet()
both errors are:"Expected class, delegate, enum, interface, or struct"

and I get "Type or namespace definition, or end-of-file expected" at the last bracket.

I'm stuck again - can anyone help me understand?

rapture 134 Posting Whiz in Training

Thanks again LizR

I finally caught on to it - I wasn't thinking about the difference between the if statements and the case on this one. I got it to work properly this way: (might still not be the best way though)

if ((strRequesterEmail != string.Empty) && (strRequesterEmail != null))
                {                   
                        objMessage.To.Add(strRequesterEmail);   
                }

            if ((strAssigneeEmail != string.Empty) && (strAssigneeEmail != null) && (strAssigneeEmail != "donotreply@dimtpa.com"))
                {
                    objMessage.To.Add(strAssigneeEmail);
                }                 
            
           if ((strAssigneeEmail == string.Empty) && if (strRequesterEmail == string.Empty))
                {               
                    objMessage.To.Add(BuildUserList(1));                
                }
rapture 134 Posting Whiz in Training

Should I combine these if statements into one larger or is it even possible? For some reason (and I'm not finished) it seems like it's a mess already .. .

if (strRequesterEmail != string.Empty)
            {
                    if (strAssigneeEmail != "donotreply@dimtpa.com")
                    {
                        if (strAssigneeEmail != null)
                        {
                            objMessage.To.Add(strRequesterEmail);
                            objMessage.To.Add(strAssigneeEmail);
                        }
                    }
                }

                if (strRequesterEmail != string.Empty)
                {
                    if (strRequesterEmail != null)
                    {
                        objMessage.To.Add(strRequesterEmail);
                    }
                }

                if (strAssigneeEmail != string.Empty)
                {
                    if (strAssigneeEmail != null)
                    {
                        objMessage.To.Add(strAssigneeEmail);
                    }
                    //        objMessage.To = BuildUserList(1)
            }
rapture 134 Posting Whiz in Training

I'm having problem in my conversion of a case statement from VB.Net to C# and need some help. I'm not reading the right material or I'm missing something somewhere . . .

Here is what I have:

switch (true)
           {
                //Case strRequesterEmail <> "" And strAssigneeEmail <> ""
                case !string.IsNullOrEmpty(strRequesterEmail) & (strAssigneeEmail != "donotreply@dimtpa.com" & !string.IsNullOrEmpty(strAssigneeEmail)):
                    objMessage.To.Add(strRequesterEmail);
                    objMessage.To.Add(strAssigneeEmail);
                    break;
                case !string.IsNullOrEmpty(strRequesterEmail):
                    objMessage.To.Add(strRequesterEmail);
                    break;
                case !string.IsNullOrEmpty(strAssigneeEmail):
                    objMessage.To.Add(strAssigneeEmail);
                    break;
                default:
                    objMessage.To.Add(BuildUserList(1));
                    break;
            }

I'm getting an error message of "A constant value is expected" at

!string.IsNullOrEmpty(strRequesterEmail)

- I tried

!(string.IsNullOrEmpty(strRequesterEmail))

- but that didn't help

rapture 134 Posting Whiz in Training

I would have thought you were in school already . . .

Here are some good ones


http://www.learnvisualstudio.net/content/series/Beginning_CSharp.aspx
http://www.codeproject.com/KB/cs/


and of course I like the Daniweb community but I wish there were some .Net tutorials in the Tutorials section . . .

rapture 134 Posting Whiz in Training

So you need us to help you find the math? you need to get help with code? You're looking for someone to code it for you or do you need advice of some other manner? Can you be a little more specific?

In general I suggest you:

1) First use pseudocode or a flowchart to map out what you want to do.
2) Next begin by working on small parts or modules of the program that you do know how to do.
3) When you get stuck, post some code example of what you have and we can more easily help you get past where you are stuck.

Remember - planning and design often takes more time than actual coding the applications. You can't just stare at the screen and start coding. Yes people like LizR could do this small app easily that way but even she couldn't do complex business programming that way and be efficient at it. So don't develop bad habits like trying to get the cart before the horse by coding without planning and design.

If you're already there, this message still applies to others who may read it. If that's the case, post what you're stuck on. (if it's stuck on where to start, have you written out the pseudocode yet? If you have then lets start by making sure it's correct. )

rapture 134 Posting Whiz in Training

Free book

http://www.c-sharpcorner.com/UploadFile/mahesh/csp08202007084545AM/csp.aspx

google c# for beginners, C# for dummies, c# tutorial etc and read, read, read then practice, practice, practice lol

rapture 134 Posting Whiz in Training

Thanks again everyone

rapture 134 Posting Whiz in Training

The 'powers that be' have decided that I need to convert the code to C# as a learning experience before we fully begin to code in C# in a couple of weeks.

rapture 134 Posting Whiz in Training

Sure boot to a command prompt or boot to the recovery console or remove the hard drive and plug it into another system as a slave, I think you can do it that way as well . . .

rapture 134 Posting Whiz in Training

I'm not sure what it is you are asking.

Basic steps are

1. Design the system
2. Code the system
3. Test the system
4. Deploy the system

of course that's very basic.

If you need to know how to do the project then that's completely different. I'm not sure people will just code it for you, I suggest that you start with small parts of what it is you want to do and post code that you come up with when you get stuck. That way we can help you through the process. But since you've already written code in vb6 it shouldn't be difficult for you to write it in .Net

rapture 134 Posting Whiz in Training

So I should attempt to convert from 1.1 to 2.0 first then attempt to convert to C# correct?

rapture 134 Posting Whiz in Training

Hello.

I'm charged with taking a site I helped create in VB.Net 1.1 to C#.Net 2.0 - I'm just starting to research this and wondered if anyone has done it and if you can direct me to some good material . . .

I need to add a new module to the site but we are trying to do all new programming in C# and in 2.0 . . . (yea I know, we're still behind . . )

Thanks

Oh and by the way - using Visual Studio 2008 . ..

rapture 134 Posting Whiz in Training

Thanks LizR

I wasn't sure if their stuff was reliable lol - someone had said that they were not quite right in the proper way to do things in the real world but I wasn't sure if that as true or not.

rapture 134 Posting Whiz in Training

Try

sql = "SELECT * FROM tblDriver WHERE dName ='" & lbDriverName.SelectedItem"'"

I think that should work - you have to have the whole statement surrounded by double quotes but to add the selected item I think you put it within double quotes within single quotes . . .

maybe this post helps:

http://www.daniweb.com/forums/post700733.html

rapture 134 Posting Whiz in Training

I'm not certain what version of Visual Studio you're using - I'm still using 2003 however we have purchased and installed 2008 and I am preparing to start using it in the next week or two..

however in 2003 in your toolbox you have the required field validator you can use - you set the validator to validate the date textbox or whatever you want and in the operator field of the properties you chose greater than or greater than equal if you want them to be able to enter todays date.

you can then insert a validation summary from the toolbox and in error message of your validator you can list the message you want to place in that summary area. So you can say "Date can not be prior to today" and it will tell them what's wrong. You can even insert a second validator and make it required so it will make sure it's also not blank and so on.

you can mess with settings like make the color red etc.

Then in your code you can put in a valid fields check - an example I've used for one of mine is here

Private Sub ValidFields()

        Dim strError As String = "Validating Request."

        Try

            cpvRequestedDueDate.ValueToCompare = DateTime.Now.Today.ToShortDateString

            rfvReqUser.Validate()
            rfvTitle.Validate()
            rfvDescription.Validate()
            rfvPriority.Validate()
            cpvRequestedDueDate.Validate()
            cpvRequestedDueDate2.Validate()
            rqvDueDate.Validate()

        Catch ex As SqlException
            PageUtil.ShortProcessErrors(ex, Session, Me, strError)
            PageUtil.ShowError(Page, strError)
        Catch ex As Exception
            PageUtil.ShortProcessErrors(ex, Session, Me, strError)
            PageUtil.ShowError(Page, strError)
        Finally
        End Try

    End Sub

in the …

rapture 134 Posting Whiz in Training

Hey all,

Does anyone have a good resource for me to read/use as I begin using C# more. I'm still very new to the language and have found that there are tons of ways to do the same thing, however many of them are the wrong way to do it when reviewed by others...

Thanks

rapture 134 Posting Whiz in Training

Hmm, all the way back to VB6 eh -

Actually you might get a better answer in the VB 4|5|6 forum than in the .Net forum. Garbage collection is different in VB6 from .Net

rapture 134 Posting Whiz in Training

I'm not talking For statements - I'm talking For Each and Next . . .

rapture 134 Posting Whiz in Training

Can you use a For Each statement with a list?

Dim word as String
For Each word in lstResults
strMedal = word
blnStartG = strMedal.StartsWith("G")

etc . . .

rapture 134 Posting Whiz in Training

You posted this more than one time . .

I responded to the other one