Hello! Being my first post on Daniweb 'n' all, I'd like to apologies if this is in the incorrect section. This isn't why I'm here, though. I am a moderator on a fairly huge forum and thus we get roughly over 1500 reports for rule-breaking posts per day across all boards. A large part of my job is handing out warnings to members, and this is a tedious process as some of you may know :( So I thought to myself "I need to make a little app to do it for me". I popped into VB because it is the language I know best (And even then my knowledge is limited) and set to work. About 10 minutes into the project, I realized I had forgotten everything I knew as I hadn't used VB for about a year.

So my question is: How would I make an app that spits out text with variable strings?

If that question is a bit confusing/shoddy, here is my GUI
http://i.imgur.com/nz5ak.png
I want to be able to enter a name, select the rule (I will change it to a fixed dropdown like the suspended box), select whether the offending content is a thread or a post, select the suspension time and enter the quoted post. The loading bar is for show because it looks nice :3

Here is the current, blank report I use. I have to change the brackets every time I use it:

Hello [NAME]


You have received [NUMBER] official board infraction point[s] for making an infringement of the rules. [Because you now have [NUMBER] infraction points, you have also been issued with a [NUMBER] day post suspension.]

You posted [in] [TOPIC] and posted the following:
[QUOTE][/QUOTE]
Which is in violation of the [RULE] rule. [Rule description - See Rules thread]

If you need to review the forum rules, you can find them [LINK - here]. If you need to review the section rules, you can find them [LINK - here]. Please don't hesitate to send me a [LINK - private message] if you have any queries about this matter.

If you continue to infringe on the forum rules and gain another infraction point, you will receive a[n/other] [NUMBER] day posting suspension.

Thank you for your cooperation, and have a nice day

Mobyguy77

All I want to do is automate this process. No bells or whistles :)

Any answer, big or small is appreciated. The boredom of filling these out is getting to me. Haha!

Thanks,

Moby

Recommended Answers

All 3 Replies

Hmmm...

First thing is I'd say this could be done a number of in different ways, really depends on what you are most comfortable with XML / XSLT or Parsing text etc.

Either way, I would make each of "Tags" unique to the piece of data you are applying.

The simplest routine I can think of is to have your Template text with the tags and then use a replace to input your data e.g.

function issueWarning (byref User as string, byref Template as string, byref Rule as String, byref InfractionPoint as integer, byref Topic as string , Optional byval DaySuspend as integer=0) as String
dim Output as string =""
Output = Replace(Replace(Replace(Replace(Template, "[USER]",User),"[RULE]", Rule),"[INFRACTION]",InfractionPoint),"[TOPIC]",Topic)
IF DaySuspended > 0 THEN
 Output = Replace(Output, "[DAYSUSPENDED]","You have also been issued with a " &DaySuspened &" Suspension."

Else
    Output = Replace(Output, "[DAYSUSPENDED]","")
END IF
Return Output
ENd function

As you can see, I'm just giving a simple example, you can make it as complex or as easy as you wish. Also, to save time I made it as a function that will return a completed string for use it your code and you pass in the template as a string - you could do this differently but I didn't want to type it all out :-)

Perfect answer my friend :D I can definitely work from this. Thanks a bunch!

Glad I could help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.